/* ==========================================================================
   Surface: profile editor (#page-editor; studio.js, editor-fields.js, editor-media.js)
   --------------------------------------------------------------------------
   Layout (studio.js): .ed-page (query container "ed") > .ed-shell (grid) >
     .ed-toolbar (.ed-tabs [role=tablist] + .ed-tools: undo/redo, .ed-status pill, .ed-more menu)
     .editor-panel > .ed-panels > .ed-panel [role=tabpanel] > .ed-card (.ed-card-head + .ed-card-body)
     .preview-wrap (sticky live preview column; full-screen sheet on narrow screens)
   + .ed-fab (floating "Посмотреть страницу", tablet) and .ed-mobilebar (sticky bottom bar, phones:
   save-state dot, secondary .ed-mobilebar-preview, primary publish).
   Two columns when the editor container is >= 700px wide (works for any sidebar width).
   Controls (editor-fields.js): .ed-field[data-control=switch|range|segmented|chips|visual|color|text|
   textarea|list], .ed-switch, .ed-range, .ed-seg, .ed-chips/.ed-chip, .ed-visuals/.ed-visual + .ed-art
   (CSS mini renders, tinted by --art-accent = the user's accent), .ed-color/.ed-hex/.ed-auto,
   .ed-list, .ed-upsell, .ed-embed, .ed-steps, .ed-clock.
   Media (editor-media.js): .ed-tracks/.ed-track, .ed-banner. Studio: .ed-asset tiles, .ed-presets,
   .ed-swatches, .ed-slug, .profile-checklist (overview).
   Legacy markup kept for app.js lives in .ed-legacy[hidden]. The preview iframe is sized by
   public-profile.js: never set width/height on .profile-preview-frame here.
   Rules: @layer surfaces, class selectors, --nv-* tokens, zero !important. Mini renders use the
   user's own accent (--art-accent) and neutral rgba() only, like the profile they depict.
   ========================================================================== */

@layer surfaces {
  /* ---- Shell & layout ------------------------------------------------------ */
  .ed-page {
    container: ed / inline-size;
  }

  .ed-shell {
    --ed-columns: 1;
    --ed-toolbar-h: 56px;
    --ed-sticky-top: calc(var(--nv-topbar-h) + var(--nv-space-2));
    --ed-preview-top: calc(var(--ed-sticky-top) + var(--ed-toolbar-h) + var(--nv-space-4));
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "bar" "form";
    align-items: start;
    column-gap: var(--nv-space-6);
  }

  .editor-panel {
    grid-area: form;
    min-width: 0;
  }

  @container ed (min-width: 700px) {
    .ed-shell {
      --ed-columns: 2;
      grid-template-columns: minmax(0, 1fr) clamp(300px, 36cqi, 440px);
      grid-template-areas: "bar bar" "form preview";
    }
  }

  @container ed (min-width: 1100px) {
    .ed-shell {
      column-gap: var(--nv-space-8);
    }
  }

  /* ---- Toolbar ------------------------------------------------------------- */
  .ed-toolbar {
    grid-area: bar;
    position: sticky;
    top: var(--ed-sticky-top);
    z-index: var(--nv-z-sticky);
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    min-height: var(--ed-toolbar-h);
    margin-bottom: var(--nv-space-5);
    padding: var(--nv-space-1) var(--nv-space-1) var(--nv-space-1) var(--nv-space-2);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-lg);
    background: var(--nv-surface-1);
  }

  /* Solid strip behind the floating bar while it is stuck: content never peeks between it and the
     top bar. Browsers without scroll-state queries always show it. */
  .ed-toolbar {
    container: ed-bar / scroll-state;
  }

  .ed-tools::before {
    content: "";
    position: absolute;
    inset: calc(-1 * var(--nv-space-2) - 2px) calc(-1 * var(--nv-gutter)) calc(100% + 1px);
    background: var(--nv-bg);
    pointer-events: none;
  }

  @container ed-bar not scroll-state(stuck: top) {
    .ed-tools::before {
      content: none;
    }
  }

  .ed-tabs {
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
    border-bottom: 0;
    -webkit-mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent);
    padding-right: 20px;
  }

  /* r181: the active section is a surface step with a hairline (like the sidebar), not an orange pill. */
  .ed-tabs > [role="tab"] {
    gap: var(--nv-space-2);
    min-height: 40px;
    padding: 0 var(--nv-space-3);
    border-radius: var(--nv-r-control);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
    transition: background-color var(--nv-dur-1) var(--nv-ease), color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-tabs > [role="tab"]::after {
    content: none;
  }

  .ed-tabs > [role="tab"] .ed-ico {
    width: 18px;
    height: 18px;
    color: var(--nv-text-3);
    transition: color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-tabs > [role="tab"]:hover {
    background: var(--nv-surface-2);
    color: var(--nv-text);
  }

  .ed-tabs > [role="tab"][aria-selected="true"] {
    background: var(--nv-surface-3);
    color: var(--nv-text);
    box-shadow: inset 0 0 0 1px var(--nv-line);
  }

  .ed-tabs > [role="tab"][aria-selected="true"] .ed-ico {
    color: var(--nv-text);
  }

  .ed-tabs > [role="tab"]:focus-visible {
    outline-offset: -2px;
  }

  .ed-tools {
    flex: none;
    display: flex;
    align-items: center;
    gap: 2px;
  }

  /* One line set at one stroke (the shell's .nv-icon is 1.5 too); small marks in 20-24px discs keep 2. */
  .ed-ico {
    flex: none;
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
  }

  .ed-tools > .icon-btn {
    --btn-h: 36px;
  }

  /* The save state is quiet meta: a plain dot and muted text, no pill around it. */
  .ed-status {
    display: inline-flex;
    align-items: center;
    gap: var(--nv-space-2);
    max-width: 232px;
    height: 36px;
    margin: 0 var(--nv-space-1);
    padding: 0 var(--nv-space-2);
    border: 1px solid transparent;
    border-radius: var(--nv-r-control);
    background: transparent;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-regular);
    white-space: nowrap;
  }

  .ed-status-dot,
  .ed-mobilebar-status::before {
    --dot: var(--nv-text-3);
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot);
  }

  .ed-status[data-state="published"] .ed-status-dot,
  .ed-mobilebar-status[data-state="published"]::before { --dot: var(--nv-success); }
  .ed-status[data-state="draft"] .ed-status-dot,
  .ed-mobilebar-status[data-state="draft"]::before { --dot: var(--nv-accent); }
  .ed-status[data-state="saving"] .ed-status-dot,
  .ed-mobilebar-status[data-state="saving"]::before { --dot: var(--nv-warning); animation: nv-pulse 1.4s var(--nv-ease) infinite; }
  .ed-status[data-state="error"] .ed-status-dot,
  .ed-mobilebar-status[data-state="error"]::before { --dot: var(--nv-danger); }
  .ed-status[data-state="offline"] .ed-status-dot,
  .ed-mobilebar-status[data-state="offline"]::before { --dot: var(--nv-warning); }

  .ed-status[data-state="error"] {
    border-color: var(--nv-danger-line);
    color: var(--nv-danger);
  }

  .ed-status-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ed-status-retry {
    flex: none;
    color: var(--nv-accent-text);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .ed-more {
    position: relative;
  }

  /* r180: on a short screen (landscape phone) the list scrolls inside itself and stops above the tab bar. */
  .ed-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 248px;
    max-height: calc(100dvh - var(--ed-sticky-top) - var(--ed-toolbar-h) - var(--ed-bottom, 0px) - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: nv-pop var(--nv-dur-2) var(--nv-ease);
  }

  .ed-page:has(.ed-menu:not([hidden])) .ed-fab {
    display: none;
  }

  .ed-menu kbd {
    margin-left: auto;
  }

  .ed-menu-history {
    display: none;
  }

  /* Medium widths: the status keeps only its dot (full text in the tooltip and the top bar). */
  @container ed (max-width: 1199px) {
    .ed-status {
      width: 36px;
      padding: 0;
      justify-content: center;
    }

    .ed-status-text {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }

    .ed-status[data-state="error"],
    .ed-status[data-state="offline"] {
      width: auto;
      padding: 0 var(--nv-space-3);
    }

    .ed-tabs > [role="tab"] {
      gap: var(--nv-space-2);
      padding: 0 var(--nv-space-3) 0 var(--nv-space-2);
      font-size: var(--nv-fs-13);
    }
  }

  @container ed (max-width: 599px) {
    .ed-toolbar {
      margin-inline: calc(-1 * var(--nv-space-2));
      padding: 4px;
    }

    .ed-tools > :is(.ed-undo, .ed-redo, .ed-status) {
      display: none;
    }

    .ed-menu-history:is(.menu-item) {
      display: flex;
    }

    .ed-menu-history:is(.menu-sep) {
      display: block;
    }

    .ed-tabs > [role="tab"] {
      min-height: 44px;
      padding: 0 12px;
      font-size: var(--nv-fs-13);
    }

    .ed-tools > .icon-btn {
      --btn-h: 44px;
    }
  }

  /* ---- Panels & cards ------------------------------------------------------ */
  .ed-panels,
  .ed-panel {
    display: grid;
    gap: var(--nv-space-4);
    min-width: 0;
  }

  .ed-panel[hidden] {
    display: none;
  }

  .ed-panel:focus {
    outline: none;
  }

  .ed-panel:not([hidden]) {
    animation: ed-panel-in var(--nv-dur-3) var(--nv-ease);
  }

  /* Cards are a surface step with a hairline; no shadow (depth comes from the steps on this dark ramp). */
  .ed-card {
    position: relative;
    min-width: 0;
    padding: var(--nv-space-5);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-lg);
    background: var(--nv-surface-1);
    scroll-margin-top: calc(var(--ed-preview-top) + var(--nv-space-2));
  }

  /* r181: the address card is a plain card (the address itself carries the signature); no wash, no gradient rim. */
  .ed-card-accent {
    border-color: var(--nv-line);
  }

  .ed-card.is-flash {
    animation: ed-flash 1.6s var(--nv-ease);
  }

  .ed-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--nv-space-3);
  }

  .ed-card-head :is(h2, h3) {
    color: var(--nv-text);
    font-size: var(--nv-fs-16);
    font-weight: var(--nv-fw-medium);
    line-height: var(--nv-lh-snug);
    letter-spacing: 0;
  }

  .ed-card-head p {
    margin-top: var(--nv-space-1);
    color: var(--nv-text-3);
    font-size: var(--nv-fs-13);
    line-height: 1.45;
  }

  .ed-card-body {
    display: grid;
    gap: var(--nv-space-4);
    min-width: 0;
    margin-top: var(--nv-space-4);
  }

  @container ed (max-width: 599px) {
    .ed-card {
      padding: var(--nv-space-4);
      border-radius: var(--nv-r-md);
    }
  }

  /* Side by side only when each field gets ~220px: the form column decides, not the page
     (at tablet width the preview column leaves the form too narrow for two fields). */
  .ed-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: var(--nv-space-4);
  }

  .ed-field-head .field-counter {
    flex: none;
    white-space: nowrap;
  }

  /* ---- Fields --------------------------------------------------------------- */
  .ed-fields {
    display: grid;
    gap: var(--nv-space-4);
    min-width: 0;
  }

  .ed-fields:empty {
    display: none;
  }

  .ed-field {
    display: grid;
    gap: var(--nv-space-2);
    min-width: 0;
  }

  .ed-field[hidden] {
    display: none;
  }

  .ed-field:not([hidden]) {
    animation: ed-field-in var(--nv-dur-3) var(--nv-ease);
  }

  /* Consecutive switch rows read as one group. */
  .ed-field[data-control="switch"] + .ed-field[data-control="switch"] {
    margin-top: calc(-1 * var(--nv-space-2));
  }

  .ed-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-2);
    min-height: 24px;
  }

  .ed-label {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--nv-space-1) var(--nv-space-2);
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    font-weight: var(--nv-fw-medium);
    line-height: var(--nv-lh-ui);
  }

  .ed-field .chip-premium {
    justify-self: start;
    width: max-content;
  }

  .ed-field .field-hint {
    margin-top: -2px;
    line-height: 1.45;
  }

  .ed-field > textarea {
    min-height: 96px;
    resize: vertical;
  }

  .ed-field[data-locked="true"] :is(input, textarea, .ed-color) {
    cursor: pointer;
  }

  /* Switch row */
  .ed-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-4);
    min-height: 56px;
    padding: var(--nv-space-3) var(--nv-space-4);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    cursor: pointer;
    transition: border-color var(--nv-dur-1) var(--nv-ease), background-color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-switch:hover {
    border-color: var(--nv-line-strong);
    background: var(--nv-surface-3);
  }

  .ed-switch-text {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .ed-switch-text small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    line-height: 1.4;
  }

  .ed-field[data-locked="true"] .ed-switch {
    border-style: dashed;
  }

  /* Range */
  .ed-range {
    gap: 4px var(--nv-space-3);
  }

  .ed-range > .ed-label {
    color: var(--nv-text);
  }

  /* Segmented & chips */
  .ed-seg {
    display: flex;
    width: 100%;
  }

  /* The selected segment is the shell's surface step with a hairline (components.css .segmented). */
  .ed-seg > button {
    min-height: 36px;
  }

  .ed-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nv-space-2);
  }

  .ed-chip {
    gap: var(--nv-space-2);
  }

  /* A selected chip is the shell's toggle chip: a surface step with a brighter hairline, like the segmented
     control (r181: no accent tint; the chosen picker tile and the primary action keep the accent). */
  .ed-chip:is([aria-checked="true"], .active) {
    border-color: var(--nv-field-line-hover);
    background: var(--nv-surface-3);
    color: var(--nv-text);
  }

  :is(.ed-chip, .ed-seg > button)[data-locked="true"] {
    color: var(--nv-text-3);
  }

  .ed-mini-lock {
    flex: none;
    width: 12px;
    height: 12px;
    background: var(--nv-premium);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V7a5 5 0 0 1 10 0v3h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1Zm2.5 0h5V7a2.5 2.5 0 0 0-5 0v3Z'/%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='M7 10V7a5 5 0 0 1 10 0v3h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1Zm2.5 0h5V7a2.5 2.5 0 0 0-5 0v3Z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .ed-sound-test {
    --btn-h: 28px;
    --btn-px: var(--nv-space-2);
  }

  .ed-sound-test .ed-ico {
    width: 16px;
    height: 16px;
  }

  /* Colour */
  .ed-fields-colors {
    gap: var(--nv-space-3);
  }

  @container ed (min-width: 420px) {
    .ed-fields-colors {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  .ed-color {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    min-height: var(--nv-h-md);
    padding: var(--nv-space-1);
    border: 1px solid var(--nv-field-line);
    border-radius: var(--nv-r-control);
    background: var(--nv-field);
    transition: border-color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-color:hover {
    border-color: var(--nv-field-line-hover);
  }

  .ed-color:focus-within {
    border-color: var(--nv-accent);
    box-shadow: var(--nv-field-ring);
  }

  /* Nested in the 10px field with 4px padding: 6px. */
  .ed-swatch {
    position: relative;
    flex: none;
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: var(--nv-r-xs);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
  }

  .ed-swatch > input[type="color"] {
    position: absolute;
    inset: -8px;
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .ed-color[data-auto="true"] .ed-swatch::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, transparent 44%, rgba(255, 255, 255, .85) 45% 55%, transparent 56%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  }

  .ed-hex {
    flex: 1;
    min-width: 0;
    min-height: 32px;
    padding: 0 var(--nv-space-2);
    border: 0;
    background: transparent;
    box-shadow: none;
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-13);
    text-transform: uppercase;
  }

  .ed-hex:is(:hover, :focus, :focus-visible) {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ed-hex::placeholder {
    text-transform: none;
  }

  .ed-hex[aria-invalid="true"] {
    color: var(--nv-danger);
  }

  /* A toggle inside the field (10px radius, 4px padding): 6px corners, the shell's toggle-chip states. */
  .ed-auto {
    flex: none;
    min-height: 28px;
    padding: var(--nv-space-1) var(--nv-space-2);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-xs);
    background: var(--nv-surface-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
    white-space: nowrap;
    transition: background-color var(--nv-dur-1) var(--nv-ease), border-color var(--nv-dur-1) var(--nv-ease), color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-auto:hover {
    color: var(--nv-text);
    border-color: var(--nv-line-strong);
    background: var(--nv-surface-3);
  }

  .ed-auto[aria-pressed="true"] {
    border-color: var(--nv-field-line-hover);
    background: var(--nv-surface-3);
    color: var(--nv-text);
  }

  .ed-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nv-space-2);
  }

  /* Quick accent swatches: flat dots; the chosen one gets a ring in its own colour (no glow, no hover zoom). */
  .ed-quick-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  }

  .ed-quick-swatch:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2), 0 0 0 2px var(--nv-surface-1), 0 0 0 3px var(--nv-line-strong);
  }

  .ed-quick-swatch[aria-pressed="true"] {
    box-shadow: 0 0 0 2px var(--nv-surface-1), 0 0 0 4px var(--swatch);
  }

  .ed-contrast {
    align-items: center;
  }

  .ed-contrast b {
    color: var(--nv-text);
  }

  /* List editor (typewriter lines) */
  .ed-list {
    display: grid;
    gap: var(--nv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ed-list:empty {
    display: none;
  }

  .ed-list-item,
  .ed-track {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--nv-space-2);
    padding: var(--nv-space-1);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .ed-list-item > input {
    min-height: 36px;
  }

  :is(.ed-list, .ed-track-list).is-sorting > li:not(.is-dragging) {
    transition: transform var(--nv-dur-2) var(--nv-ease);
  }

  /* The row in the hand floats: one soft neutral shadow and an accent hairline. */
  :is(.ed-list-item, .ed-track).is-dragging {
    z-index: 2;
    border-color: var(--nv-accent-line);
    background: var(--nv-surface-3);
    box-shadow: var(--nv-shadow-2);
  }

  .ed-grip {
    display: grid;
    place-items: center;
    width: 28px;
    height: 36px;
    border-radius: var(--nv-r-xs);
    color: var(--nv-text-3);
    cursor: grab;
    touch-action: none;
  }

  .ed-grip:hover {
    background: var(--nv-surface-3);
    color: var(--nv-text);
  }

  .ed-grip:active {
    cursor: grabbing;
  }

  .ed-grip:disabled {
    opacity: .3;
    cursor: default;
  }

  .ed-grip .ed-ico {
    width: 16px;
    height: 16px;
  }

  .ed-list-remove,
  .ed-track-actions > .icon-btn {
    --btn-h: 36px;
  }

  .ed-list-remove:hover,
  .ed-track-remove:hover {
    color: var(--nv-danger);
    background: var(--nv-danger-soft);
  }

  .ed-list-add {
    justify-self: start;
  }

  .ed-list-add .ed-ico {
    width: 16px;
    height: 16px;
  }

  /* Inline Premium upsell: a quiet row with an accent hairline (no gradient fill or rim). */
  .ed-upsell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-3);
    padding: var(--nv-space-2) var(--nv-space-2) var(--nv-space-2) var(--nv-space-4);
    border: 1px solid var(--nv-accent-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    line-height: 1.4;
    animation: ed-field-in var(--nv-dur-3) var(--nv-ease);
  }

  .ed-upsell[hidden] {
    display: none;
  }

  .ed-upsell-text {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--nv-space-2);
    min-width: 0;
  }

  /* ---- Visual pickers (effects, layouts, frames, fonts) -------------------- */
  .ed-visuals {
    --art-accent: var(--nv-accent);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: var(--nv-space-2);
  }

  .ed-visuals-font,
  .ed-visuals-nick {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  /* A tile is a surface step that stays put on hover; the chosen one gets a 2px accent rim and nothing else. */
  .ed-visual {
    position: relative;
    display: grid;
    gap: var(--nv-space-2);
    min-width: 0;
    padding: var(--nv-space-1) var(--nv-space-1) var(--nv-space-2);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    color: var(--nv-text-2);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--nv-dur-1) var(--nv-ease), background-color var(--nv-dur-1) var(--nv-ease), color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-visual:hover {
    border-color: var(--nv-line-strong);
    background: var(--nv-surface-3);
    color: var(--nv-text);
  }

  .ed-visual[aria-checked="true"] {
    border-color: var(--nv-accent);
    color: var(--nv-text);
    box-shadow: 0 0 0 1px var(--nv-accent);
  }

  .ed-visual:focus-visible {
    outline-offset: 2px;
  }

  .ed-visual-label {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    min-width: 0;
    padding: 0 var(--nv-space-1);
    font-size: var(--nv-fs-13);
    font-weight: var(--nv-fw-medium);
    line-height: 1.25;
  }

  .ed-visual-label > span:first-child {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  /* r164: a small lock per locked tile (was a full «PREMIUM» chip on every tile). */
  .ed-visual-lock {
    position: absolute;
    top: var(--nv-space-2);
    right: var(--nv-space-2);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(12, 11, 10, .78);
    box-shadow: inset 0 0 0 1px var(--nv-line-strong);
  }

  .ed-visual-lock > .ed-mini-lock {
    width: 12px;
    height: 12px;
  }

  .ed-visual[data-locked="true"] .ed-art {
    filter: saturate(.75) brightness(.85);
  }

  /* One line under a picker: «Ещё N в Premium · Открыть». */
  .ed-locked-line {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    margin: 0;
    color: var(--nv-text-2);
    font-size: var(--nv-fs-12);
    line-height: var(--nv-lh-ui);
  }

  .ed-locked-line > .ed-mini-lock {
    width: 12px;
    height: 12px;
  }

  .ed-locked-open {
    color: var(--nv-premium);
    font-weight: var(--nv-fw-medium);
    text-decoration: none;
  }

  .ed-locked-open:hover {
    text-decoration: underline;
  }

  .ed-visual-check {
    position: absolute;
    top: var(--nv-space-2);
    left: var(--nv-space-2);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--nv-accent);
    color: var(--nv-on-accent);
    opacity: 0;
    transition: opacity var(--nv-dur-2) var(--nv-ease);
  }

  /* The one stroke exception (r181): a 12px glyph (in a 20-24px disc, a track's remove key, the overview delta
     arrow) takes stroke 2, so it draws the same 1px line as a 16px icon at 1.5. Every other icon is 1.5. */
  .ed-visual-check .ed-ico {
    width: 12px;
    height: 12px;
    stroke-width: 2;
  }

  .ed-visual[aria-checked="true"] .ed-visual-check {
    opacity: 1;
  }

  /* Idle previews stay still; hovered, focused and selected ones animate. r181: this never held. The art's own
     `animation` shorthands (up to 0,3,1, e.g. .ed-art-bg[data-art] > i:first-child) reset the play state, and
     pseudo-elements inside :is() are dropped, so every tile ran at rest. The picker ancestor lifts these rules
     to 0,4,x, and the pseudo-elements are listed on their own. */
  .ed-visuals .ed-visual:not(:hover, :focus-visible, [aria-checked="true"]) :is(.ed-art, .ed-art *),
  .ed-visuals .ed-visual:not(:hover, :focus-visible, [aria-checked="true"]) .ed-art::before,
  .ed-visuals .ed-visual:not(:hover, :focus-visible, [aria-checked="true"]) .ed-art::after,
  .ed-presets .ed-preset:not(:hover, :focus-visible) :is(.ed-preset-art > i) {
    animation-play-state: paused;
  }

  .ed-art {
    --a: var(--art-accent, var(--nv-accent));
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border-radius: calc(var(--nv-r-md) - 4px);
    background: var(--art-bg, var(--nv-bg-deep));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
    isolation: isolate;
  }

  .ed-art-bg > i,
  .ed-preset-art > i {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  /* Background effects -------------------------------------------------------- */
  .ed-art-bg {
    --art-bg: var(--nv-bg-deep);
    background:
      radial-gradient(90% 70% at 50% 120%, color-mix(in srgb, var(--a) 16%, transparent), transparent 70%),
      var(--art-bg);
  }

  .ed-art-bg[data-art="none"] > i:first-child {
    inset: 50% auto auto 50%;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    transform: translate(-50%, -50%);
  }

  .ed-art-bg[data-art="none"] > i:nth-child(2) {
    inset: 50% auto auto 50%;
    width: 30px;
    height: 2px;
    background: rgba(255, 255, 255, .18);
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .ed-art-bg[data-art="mesh"] > i:first-child {
    inset: -30%;
    background:
      radial-gradient(40% 40% at 25% 30%, color-mix(in srgb, var(--a) 75%, transparent), transparent 70%),
      radial-gradient(35% 35% at 75% 65%, color-mix(in srgb, var(--a) 45%, white 10%), transparent 70%),
      radial-gradient(30% 30% at 60% 20%, rgba(255, 255, 255, .16), transparent 70%);
    filter: blur(6px);
    animation: ed-drift 9s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="aurora"] > i:first-child,
  .ed-art-bg[data-art="aurora"] > i:nth-child(2) {
    inset: -20% -30%;
    background: linear-gradient(100deg, transparent 25%, color-mix(in srgb, var(--a) 70%, transparent) 42%, transparent 58%);
    filter: blur(10px);
    transform: skewY(-14deg);
    animation: ed-aurora 7s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="aurora"] > i:nth-child(2) {
    background: linear-gradient(100deg, transparent 40%, color-mix(in oklch, var(--a), white 45%) 52%, transparent 64%);
    opacity: .55;
    animation-duration: 9s;
    animation-direction: alternate-reverse;
  }

  .ed-art-bg[data-art="grain"] > i:first-child {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    opacity: .9;
    animation: ed-grain .6s steps(3) infinite;
  }

  .ed-art-bg[data-art="grain"] > i:nth-child(2) {
    background: radial-gradient(80% 80% at 50% 50%, transparent 40%, rgba(0, 0, 0, .55));
  }

  .ed-art-bg[data-art="particles"] > i:first-child,
  .ed-art-bg[data-art="particles"] > i:nth-child(2) {
    background-image:
      radial-gradient(circle, var(--a) 0 1.6px, transparent 2.2px),
      radial-gradient(circle, color-mix(in srgb, var(--a) 60%, white) 0 1px, transparent 1.6px);
    background-size: 34px 30px, 22px 26px;
    background-position: 0 0, 11px 9px;
    opacity: .85;
    animation: ed-rise 6s linear infinite;
  }

  .ed-art-bg[data-art="particles"] > i:nth-child(2) {
    background-size: 46px 40px, 30px 34px;
    opacity: .45;
    animation-duration: 10s;
  }

  .ed-art-bg[data-art="snow"] > i:first-child,
  .ed-art-bg[data-art="snow"] > i:nth-child(2) {
    background-image:
      radial-gradient(circle, rgba(255, 255, 255, .95) 0 1.5px, transparent 2px),
      radial-gradient(circle, rgba(255, 255, 255, .7) 0 1px, transparent 1.5px);
    background-size: 30px 28px, 18px 22px;
    background-position: 4px 0, 13px 7px;
    animation: ed-fall 5s linear infinite;
  }

  .ed-art-bg[data-art="snow"] > i:nth-child(2) {
    background-size: 44px 40px, 26px 30px;
    opacity: .5;
    filter: blur(.5px);
    animation-duration: 8s;
  }

  .ed-art-bg[data-art="rain"] > i:first-child {
    inset: -40% 0;
    background-image: repeating-linear-gradient(100deg, transparent 0 9px, rgba(255, 255, 255, .28) 9px 10px, transparent 10px 23px);
    background-size: 100% 26px;
    -webkit-mask-image: repeating-linear-gradient(180deg, black 0 12px, transparent 12px 26px);
    mask-image: repeating-linear-gradient(180deg, black 0 12px, transparent 12px 26px);
    animation: ed-rain .7s linear infinite;
  }

  .ed-art-bg[data-art="rain"] > i:nth-child(2) {
    background: linear-gradient(180deg, color-mix(in srgb, var(--a) 14%, transparent), transparent 60%);
  }

  .ed-art-bg[data-art="stars"] > i:first-child,
  .ed-art-bg[data-art="stars"] > i:nth-child(2) {
    background-image:
      radial-gradient(circle, rgba(255, 255, 255, .95) 0 1px, transparent 1.4px),
      radial-gradient(circle, color-mix(in srgb, var(--a) 70%, white) 0 1px, transparent 1.5px);
    background-size: 23px 19px, 37px 31px;
    background-position: 3px 5px, 17px 11px;
  }

  .ed-art-bg[data-art="stars"] > i:nth-child(2) {
    background-size: 29px 27px, 41px 35px;
    background-position: 13px 2px, 5px 21px;
    animation: ed-twinkle 2.4s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="bubbles"] > i:first-child,
  .ed-art-bg[data-art="bubbles"] > i:nth-child(2) {
    background-image: radial-gradient(circle, transparent 0 5px, color-mix(in srgb, var(--a) 70%, white) 5.5px 6.5px, transparent 7px);
    background-size: 36px 40px;
    background-position: 6px 10px;
    opacity: .75;
    animation: ed-rise 7s linear infinite;
  }

  .ed-art-bg[data-art="bubbles"] > i:nth-child(2) {
    background-image: radial-gradient(circle, transparent 0 3px, rgba(255, 255, 255, .45) 3.5px 4.3px, transparent 4.8px);
    background-size: 26px 30px;
    background-position: 19px 2px;
    animation-duration: 5s;
  }

  .ed-art-bg[data-art="night"] {
    background: linear-gradient(180deg, color-mix(in srgb, var(--a) 22%, var(--nv-bg-deep)), var(--nv-bg-deep) 85%);
  }

  .ed-art-bg[data-art="night"] > i:first-child {
    inset: 18% 18% auto auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset -6px -2px 0 0 rgba(255, 246, 230, .95), 0 0 18px rgba(255, 246, 230, .25);
  }

  .ed-art-bg[data-art="night"] > i:nth-child(2) {
    background-image: radial-gradient(circle, rgba(255, 255, 255, .8) 0 .8px, transparent 1.3px);
    background-size: 21px 17px;
    -webkit-mask-image: linear-gradient(180deg, black, transparent 70%);
    mask-image: linear-gradient(180deg, black, transparent 70%);
    animation: ed-twinkle 3s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="old-tv"] {
    background: radial-gradient(70% 70% at 50% 45%, color-mix(in srgb, var(--a) 26%, var(--nv-bg-deep)), var(--nv-bg-deep));
  }

  .ed-art-bg[data-art="old-tv"] > i:first-child {
    background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 3px);
    animation: ed-flicker .18s steps(2) infinite;
  }

  .ed-art-bg[data-art="old-tv"] > i:nth-child(2) {
    background: radial-gradient(90% 90% at 50% 50%, transparent 45%, rgba(0, 0, 0, .75));
  }

  .ed-art-bg[data-art="old-tv"] > i:nth-child(3) {
    inset: auto 0 0;
    height: 30%;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .06), transparent);
    animation: ed-roll 2.6s linear infinite;
  }

  .ed-art-bg[data-art="blur"] > i:first-child {
    inset: -20%;
    background:
      radial-gradient(30% 35% at 30% 40%, color-mix(in srgb, var(--a) 85%, transparent), transparent 70%),
      radial-gradient(25% 30% at 70% 60%, rgba(255, 255, 255, .35), transparent 70%),
      radial-gradient(30% 30% at 55% 25%, color-mix(in oklch, var(--a), white 40%), transparent 70%);
    filter: blur(14px);
    animation: ed-drift 8s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="matrix"] > i:first-child,
  .ed-art-bg[data-art="matrix"] > i:nth-child(2) {
    inset: -50% 0 0;
    background-image: repeating-linear-gradient(180deg, var(--a) 0 3px, transparent 3px 7px);
    -webkit-mask-image: repeating-linear-gradient(90deg, black 0 3px, transparent 3px 11px);
    mask-image: repeating-linear-gradient(90deg, black 0 3px, transparent 3px 11px);
    opacity: .85;
    animation: ed-fall 2.4s linear infinite;
  }

  .ed-art-bg[data-art="matrix"] > i:nth-child(2) {
    inset: -50% 0 0 5px;
    opacity: .35;
    animation-duration: 3.6s;
  }

  .ed-art-bg[data-art="matrix"] > i:nth-child(3) {
    background: linear-gradient(180deg, var(--art-bg) 0%, transparent 35%, transparent 70%, var(--art-bg));
  }

  .ed-art-bg[data-art="network"] > i:first-child {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 100'%3E%3Cg stroke='white' stroke-opacity='.28' stroke-width='.8'%3E%3Cpath d='M18 22 52 40 88 18 126 34 146 72M52 40 64 78 104 66 126 34M18 22 30 64 64 78M88 18 104 66 146 72'/%3E%3C/g%3E%3C/svg%3E");
    background-size: cover;
  }

  .ed-art-bg[data-art="network"] > i:nth-child(2) {
    background:
      radial-gradient(circle at 11% 22%, var(--a) 0 2.4px, transparent 3px),
      radial-gradient(circle at 32.5% 40%, var(--a) 0 2.4px, transparent 3px),
      radial-gradient(circle at 55% 18%, white 0 2px, transparent 2.6px),
      radial-gradient(circle at 79% 34%, var(--a) 0 2.4px, transparent 3px),
      radial-gradient(circle at 91% 72%, white 0 2px, transparent 2.6px),
      radial-gradient(circle at 40% 78%, var(--a) 0 2.4px, transparent 3px),
      radial-gradient(circle at 65% 66%, white 0 2px, transparent 2.6px),
      radial-gradient(circle at 19% 64%, var(--a) 0 2px, transparent 2.6px);
    animation: ed-twinkle 2.6s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="fireflies"] > i:first-child,
  .ed-art-bg[data-art="fireflies"] > i:nth-child(2) {
    background:
      radial-gradient(circle at 20% 70%, color-mix(in srgb, var(--a) 90%, white) 0 2px, color-mix(in srgb, var(--a) 40%, transparent) 3px, transparent 9px),
      radial-gradient(circle at 62% 35%, color-mix(in srgb, var(--a) 90%, white) 0 2px, color-mix(in srgb, var(--a) 40%, transparent) 3px, transparent 9px),
      radial-gradient(circle at 84% 75%, color-mix(in srgb, var(--a) 90%, white) 0 1.5px, color-mix(in srgb, var(--a) 40%, transparent) 2.5px, transparent 8px);
    animation: ed-float 4s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-bg[data-art="fireflies"] > i:nth-child(2) {
    background:
      radial-gradient(circle at 38% 22%, color-mix(in srgb, var(--a) 90%, white) 0 1.5px, color-mix(in srgb, var(--a) 40%, transparent) 2.5px, transparent 8px),
      radial-gradient(circle at 72% 58%, color-mix(in srgb, var(--a) 90%, white) 0 2px, color-mix(in srgb, var(--a) 40%, transparent) 3px, transparent 9px),
      radial-gradient(circle at 10% 30%, color-mix(in srgb, var(--a) 90%, white) 0 1.5px, color-mix(in srgb, var(--a) 40%, transparent) 2.5px, transparent 8px);
    animation-duration: 5.5s;
    animation-direction: alternate-reverse;
  }

  .ed-art-bg[data-art="plasma"] > i:first-child {
    inset: -40%;
    background: conic-gradient(from 0deg in oklch longer hue, var(--a), var(--a));
    filter: blur(16px) saturate(1.2);
    opacity: .75;
    animation: ed-spin 10s linear infinite;
  }

  .ed-art-bg[data-art="plasma"] > i:nth-child(2) {
    background: radial-gradient(60% 60% at 50% 50%, transparent, rgba(0, 0, 0, .55));
  }

  .ed-art-bg[data-art="dither"] > i:first-child {
    background: repeating-conic-gradient(var(--a) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
    -webkit-mask-image: linear-gradient(180deg, transparent 5%, black 95%);
    mask-image: linear-gradient(180deg, transparent 5%, black 95%);
    opacity: .7;
  }

  .ed-art-bg[data-art="dither"] > i:nth-child(2) {
    background: repeating-conic-gradient(rgba(255, 255, 255, .5) 0 25%, transparent 0 50%) 0 0 / 2px 2px;
    -webkit-mask-image: radial-gradient(40% 50% at 30% 35%, black, transparent);
    mask-image: radial-gradient(40% 50% at 30% 35%, black, transparent);
    opacity: .5;
  }

  /* Name effects ------------------------------------------------------------- */
  .ed-art-nick {
    display: grid;
    place-items: center;
    background:
      radial-gradient(80% 60% at 50% 110%, color-mix(in srgb, var(--a) 12%, transparent), transparent 70%),
      var(--nv-bg-deep);
  }

  .ed-nick {
    position: relative;
    display: inline-flex;
    color: var(--nv-text);
    font-family: var(--nv-font-display);
    font-size: 23px;
    font-weight: var(--nv-fw-heavy);
    letter-spacing: -.02em;
    line-height: 1;
  }

  .ed-nick > span {
    display: inline-block;
  }

  .ed-art-nick[data-art="glow"] .ed-nick {
    text-shadow: 0 0 10px color-mix(in srgb, var(--a) 90%, transparent), 0 0 22px color-mix(in srgb, var(--a) 55%, transparent);
  }

  .ed-art-nick:is([data-art="gradient"], [data-art="shimmer"], [data-art="rainbow"]) .ed-nick {
    background: linear-gradient(90deg, var(--nv-text), var(--a));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .ed-art-nick[data-art="shimmer"] .ed-nick {
    background: linear-gradient(110deg, var(--nv-text) 35%, var(--a) 48%, white 52%, var(--nv-text) 65%) 0 0 / 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: ed-shimmer 2.2s linear infinite;
  }

  .ed-art-nick[data-art="rainbow"] .ed-nick {
    background: linear-gradient(90deg in oklch longer hue, var(--a), var(--a)) 0 0 / 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: ed-shimmer 3s linear infinite;
  }

  /* r181: started past its typing phase, so the still tile (pickers rest still) shows the typed word, not an
     empty well; on hover it carries on from there. */
  .ed-art-nick[data-art="typing"] .ed-nick {
    clip-path: inset(0 100% 0 0);
    animation: ed-type 2.8s steps(4) infinite;
    animation-delay: -1.7s;
  }

  .ed-art-nick[data-art="typing"]::after {
    content: "";
    position: absolute;
    left: calc(50% + 30px);
    top: calc(50% - 13px);
    width: 2px;
    height: 26px;
    background: var(--a);
    animation: ed-blink .9s steps(2) infinite;
  }

  .ed-art-nick[data-art="shuffle"] .ed-nick > span {
    animation: ed-shuffle 1.2s steps(3) infinite;
    animation-delay: calc(var(--i) * -.3s);
  }

  .ed-art-nick[data-art="fuzzy"] .ed-nick {
    filter: blur(.4px);
    text-shadow: 1px 0 rgba(255, 255, 255, .4), -1px 0 color-mix(in srgb, var(--a) 70%, transparent);
    animation: ed-jitter .25s steps(2) infinite;
  }

  .ed-art-nick[data-art="sparkle"]::before,
  .ed-art-nick[data-art="sparkle"]::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: color-mix(in srgb, var(--a) 60%, white);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    animation: ed-twinkle 1.4s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-nick[data-art="sparkle"]::before {
    left: 24%;
    top: 26%;
  }

  .ed-art-nick[data-art="sparkle"]::after {
    right: 22%;
    bottom: 24%;
    width: 6px;
    height: 6px;
    animation-delay: -.7s;
  }

  .ed-art-nick[data-art="sparkle"] .ed-nick {
    text-shadow: 0 0 8px color-mix(in srgb, var(--a) 40%, transparent);
  }

  .ed-art-nick[data-art="glitch"] .ed-nick {
    text-shadow: 2px 0 color-mix(in srgb, var(--a) 90%, transparent), -2px 0 rgba(140, 230, 255, .75);
    animation: ed-glitch 1.8s steps(1) infinite;
  }

  .ed-art-nick[data-art="neon"] .ed-nick {
    color: color-mix(in srgb, var(--a) 30%, white);
    text-shadow: 0 0 2px white, 0 0 8px var(--a), 0 0 18px var(--a), 0 0 34px color-mix(in srgb, var(--a) 70%, transparent);
    animation: ed-neon 3s steps(1) infinite;
  }

  .ed-art-nick[data-art="wave"] .ed-nick > span {
    animation: ed-wave 1.4s var(--nv-ease-in-out) infinite;
    animation-delay: calc(var(--i) * .12s);
  }

  .ed-art-nick[data-art="wave"] .ed-nick {
    color: color-mix(in srgb, var(--a) 35%, white);
  }

  /* Cursor effects ------------------------------------------------------------ */
  .ed-art-cursor {
    background:
      radial-gradient(70% 70% at 30% 30%, color-mix(in srgb, var(--a) 10%, transparent), transparent 70%),
      var(--nv-bg-deep);
  }

  .ed-art-pointer {
    position: absolute;
    left: 62%;
    top: 46%;
    z-index: 2;
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6));
  }

  .ed-art-cursor > i {
    position: absolute;
    left: calc(62% - (var(--n) * 11%));
    top: calc(46% - (var(--n) * 7%));
    width: calc(11px - var(--n) * 1.4px);
    height: calc(11px - var(--n) * 1.4px);
    border-radius: 50%;
    opacity: 0;
  }

  .ed-art-cursor > i:nth-child(1) { --n: 1; }
  .ed-art-cursor > i:nth-child(2) { --n: 2; }
  .ed-art-cursor > i:nth-child(3) { --n: 3; }
  .ed-art-cursor > i:nth-child(4) { --n: 4; }
  .ed-art-cursor > i:nth-child(5) { --n: 5; }

  .ed-art-cursor:is([data-art="trail"], [data-art="comet"], [data-art="rainbow"], [data-art="bubbles"], [data-art="sparkle"], [data-art="stars"], [data-art="snow"], [data-art="ghost"]) > i {
    opacity: calc(1 - var(--n) * .17);
    animation: ed-trail 1.6s var(--nv-ease-in-out) infinite;
    animation-delay: calc(var(--n) * -.12s);
  }

  .ed-art-cursor[data-art="trail"] > i {
    background: var(--a);
    box-shadow: 0 0 8px color-mix(in srgb, var(--a) 70%, transparent);
  }

  .ed-art-cursor[data-art="rainbow"] > i {
    background: hsl(from var(--a) calc(h + var(--n) * 55) s l);
    box-shadow: 0 0 8px hsl(from var(--a) calc(h + var(--n) * 55) s l / .6);
  }

  .ed-art-cursor[data-art="bubbles"] > i {
    border: 1.5px solid color-mix(in srgb, var(--a) 70%, white);
    background: transparent;
  }

  .ed-art-cursor:is([data-art="sparkle"], [data-art="stars"]) > i {
    width: calc(13px - var(--n) * 1.5px);
    height: calc(13px - var(--n) * 1.5px);
    border-radius: 0;
    background: color-mix(in srgb, var(--a) 55%, white);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  }

  .ed-art-cursor[data-art="stars"] > i {
    clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background: var(--a);
  }

  .ed-art-cursor[data-art="snow"] > i {
    width: 5px;
    height: 5px;
    background: white;
    left: calc(62% - (var(--n) * 9%) + (var(--n) * var(--n) * 1%));
    top: calc(46% + (var(--n) * 6%));
  }

  .ed-art-cursor[data-art="ghost"] > i {
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: rgba(255, 255, 255, .55);
    clip-path: polygon(10% 0, 85% 52%, 52% 58%, 36% 92%);
    opacity: calc(.6 - var(--n) * .11);
  }

  .ed-art-cursor[data-art="comet"] > i:first-child {
    left: 22%;
    top: 22%;
    width: 46%;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--a) 70%, transparent), white);
    transform: rotate(31deg);
    transform-origin: right center;
    filter: blur(.6px);
    opacity: .95;
    animation: none;
  }

  .ed-art-cursor[data-art="comet"] > i:not(:first-child) {
    display: none;
  }

  .ed-art-cursor[data-art="dot"] > i:first-child {
    left: calc(62% - 9px);
    top: calc(46% - 9px);
    width: 30px;
    height: 30px;
    border: 2px solid var(--a);
    background: color-mix(in srgb, var(--a) 14%, transparent);
    opacity: 1;
    animation: ed-follow 2s var(--nv-ease-in-out) infinite;
  }

  /* Layout wireframes (a picker, not an effect: flat shapes on the plain well, the accent only on the parts
     it colours on the page) ---------------------------------------------------- */
  .ed-art-layout {
    display: grid;
    place-items: center;
  }

  .ed-wire {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 4px;
    width: 64%;
    height: 82%;
    padding: 9px 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
  }

  .ed-wire b {
    display: block;
    border-radius: 3px;
  }

  .w-banner {
    display: none;
  }

  .w-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--a) 70%, white);
  }

  .w-name {
    width: 46%;
    height: 4px;
    margin-top: 2px;
    background: rgba(255, 255, 255, .85);
  }

  .w-bio {
    width: 66%;
    height: 3px;
    background: rgba(255, 255, 255, .3);
  }

  .w-links {
    display: flex;
    gap: 4px;
    margin-top: 3px;
  }

  .w-links > b {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--a) 80%, white);
  }

  .ed-art-layout[data-art="minimal"] .ed-wire {
    grid-template-columns: auto 1fr;
    justify-items: start;
    align-content: center;
    column-gap: 6px;
    border-color: transparent;
    background: transparent;
  }

  .ed-art-layout[data-art="minimal"] .w-avatar {
    grid-row: span 2;
    width: 18px;
    height: 18px;
  }

  .ed-art-layout[data-art="minimal"] :is(.w-name, .w-bio) {
    width: 80%;
    margin: 0;
  }

  .ed-art-layout[data-art="minimal"] .w-links {
    grid-column: 1 / -1;
  }

  .ed-art-layout[data-art="sleek"] .ed-wire {
    justify-items: start;
    padding-top: 0;
  }

  .ed-art-layout[data-art="sleek"] .w-banner {
    display: block;
    width: calc(100% + 16px);
    height: 30%;
    margin: 0 -8px;
    border-radius: 0;
    background: color-mix(in srgb, var(--a) 55%, transparent);
  }

  .ed-art-layout[data-art="sleek"] .w-avatar {
    margin-top: -10px;
    box-shadow: 0 0 0 2px var(--nv-bg-deep);
  }

  .ed-art-layout[data-art="stack"] .w-links {
    display: grid;
    width: 88%;
    gap: 3px;
  }

  .ed-art-layout[data-art="stack"] .w-links > b {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--a) 55%, transparent);
  }

  /* Avatar frames ------------------------------------------------------------- */
  .ed-art-frame {
    display: grid;
    place-items: center;
    background: var(--nv-bg-deep);
  }

  .ed-art-frame > i {
    grid-area: 1 / 1;
    border-radius: 50%;
  }

  .ed-ava {
    width: 40px;
    height: 40px;
    background:
      radial-gradient(circle at 50% 38%, rgba(255, 255, 255, .55) 0 7px, transparent 7.5px),
      radial-gradient(circle at 50% 100%, rgba(255, 255, 255, .45) 0 15px, transparent 15.5px),
      linear-gradient(160deg, var(--nv-surface-4), var(--nv-surface-2));
    z-index: 1;
  }

  .ed-ring {
    width: 50px;
    height: 50px;
  }

  .ed-art-frame[data-art="ring"] .ed-ring {
    border: 2px solid var(--a);
  }

  .ed-art-frame[data-art="glow"] .ed-ring {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--a) 70%, transparent), 0 0 18px var(--a);
  }

  .ed-art-frame[data-art="rainbow"] .ed-ring {
    background: conic-gradient(from 0deg in oklch longer hue, var(--a), var(--a));
    -webkit-mask: radial-gradient(circle, transparent 0 22px, black 23px);
    mask: radial-gradient(circle, transparent 0 22px, black 23px);
    animation: ed-spin 4s linear infinite;
  }

  .ed-art-frame[data-art="flames"] .ed-ring {
    width: 58px;
    height: 58px;
    background: radial-gradient(circle at 50% 60%, transparent 0 20px, color-mix(in srgb, var(--a) 90%, white 10%) 22px, color-mix(in srgb, var(--a) 40%, transparent) 26px, transparent 30px);
    filter: blur(1.5px);
    animation: ed-flame 1.1s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-frame[data-art="stars"] .ed-ring {
    width: 64px;
    height: 64px;
    background:
      radial-gradient(circle at 50% 4%, white 0 1.6px, transparent 2.2px),
      radial-gradient(circle at 92% 38%, var(--a) 0 2px, transparent 2.6px),
      radial-gradient(circle at 78% 90%, white 0 1.4px, transparent 2px),
      radial-gradient(circle at 14% 82%, var(--a) 0 2px, transparent 2.6px),
      radial-gradient(circle at 6% 30%, white 0 1.4px, transparent 2px);
    animation: ed-spin 9s linear infinite;
  }

  .ed-art-frame[data-art="halo"] .ed-ring {
    width: 34px;
    height: 10px;
    margin-bottom: 54px;
    border: 2px solid color-mix(in srgb, var(--a) 60%, white);
    box-shadow: 0 0 10px var(--a);
    z-index: 2;
    animation: ed-float 2.4s var(--nv-ease-in-out) infinite alternate;
  }

  .ed-art-frame[data-art="pulse"] .ed-ring {
    width: 44px;
    height: 44px;
    border: 2px solid var(--a);
    animation: ed-pulse-ring 1.6s var(--nv-ease-out) infinite;
  }

  /* Font samples: the specimen on the plain well (the weight shows the face as the page sets the name). */
  .ed-art-font {
    display: grid;
    place-items: center;
    color: var(--nv-text);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
  }

  /* ---- Themes (preset mini renders) ---------------------------------------- */
  .ed-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--nv-space-3);
  }

  /* Same tile as the visual pickers: a surface step on hover, a 2px accent rim when chosen. */
  .ed-preset {
    position: relative;
    display: grid;
    gap: var(--nv-space-2);
    min-width: 0;
    padding: var(--nv-space-1) var(--nv-space-1) var(--nv-space-3);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--nv-dur-1) var(--nv-ease), background-color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-preset:hover {
    border-color: var(--nv-line-strong);
    background: var(--nv-surface-3);
  }

  .ed-preset[aria-checked="true"] {
    border-color: var(--nv-accent);
    box-shadow: 0 0 0 1px var(--nv-accent);
  }

  .ed-preset-art {
    --a: var(--art-accent);
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: calc(var(--nv-r-md) - 4px);
    isolation: isolate;
  }

  .ed-preset-card {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 4px;
    width: 62%;
    padding: 9px 8px 10px;
    border: 1px solid color-mix(in srgb, var(--p-text) 14%, transparent);
    border-radius: var(--p-radius);
    background: var(--p-fill);
    box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }

  .ed-preset-card.is-left {
    justify-items: start;
  }

  .ed-preset-card > b {
    display: block;
    border-radius: 3px;
  }

  .ed-preset-card > .p-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--p-accent), color-mix(in srgb, var(--p-accent) 45%, var(--p-text)));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-text) 18%, transparent);
  }

  .p-name {
    width: 55%;
    height: 5px;
    margin-top: 2px;
    background: var(--p-text);
  }

  .p-bio {
    width: 76%;
    height: 3px;
    background: color-mix(in srgb, var(--p-text) 40%, transparent);
  }

  .p-links {
    display: flex;
    gap: 4px;
    margin-top: 3px;
  }

  .p-links > b {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: var(--p-accent);
  }

  .ed-preset-meta {
    display: grid;
    gap: 2px;
    padding: 0 var(--nv-space-1);
  }

  .ed-preset-meta b {
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    font-weight: var(--nv-fw-medium);
  }

  .ed-preset-meta small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  /* «Активна» over the mini render: a solid tag (no glass blur, no shadow) so it reads on light themes too. */
  .ed-preset-active {
    position: absolute;
    top: var(--nv-space-3);
    right: var(--nv-space-3);
    z-index: 2;
    display: none;
    background: var(--nv-surface-1);
  }

  .ed-preset[aria-checked="true"] .ed-preset-active {
    display: inline-flex;
  }

  /* ---- Public address ------------------------------------------------------ */
  .ed-slug {
    display: grid;
    gap: var(--nv-space-2);
  }

  /* The signature: one address in mono, the host dim and the name bright, nova-link.lol/name (no box around
     the host, so the two halves read as one string). */
  .ed-slug .slug-field {
    min-height: 48px;
    padding: var(--nv-space-1);
    border-radius: var(--nv-r-md);
  }

  .ed-slug .slug-field > .input-prefix {
    padding: 0 0 0 var(--nv-space-3);
    border-radius: calc(var(--nv-r-md) - 4px);
    background: transparent;
    color: var(--nv-address-host);
    font-family: var(--nv-address-font);
    font-size: var(--nv-fs-16);
  }

  .ed-slug .slug-field > input {
    min-width: 0;
    min-height: 40px;
    padding-left: 0;
    color: var(--nv-address-name);
    font-family: var(--nv-address-font);
    font-size: var(--nv-fs-16);
    font-weight: var(--nv-fw-medium);
    text-overflow: ellipsis;
  }

  .ed-slug-btn {
    --btn-h: 40px;
    border-radius: calc(var(--nv-r-md) - 4px);
  }

  .slug-status {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    min-height: 20px;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
  }

  .slug-status:empty {
    display: none;
  }

  .slug-status::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
  }

  .slug-status.success {
    color: var(--nv-success);
  }

  .slug-status.error {
    color: var(--nv-danger);
  }

  .slug-status.checking {
    color: var(--nv-warning);
  }

  .slug-status.checking::before {
    animation: nv-pulse 1s var(--nv-ease) infinite;
  }

  /* Release 163: a free 3–4 character address that must be bought (studio.js setSlugPaid). */
  .slug-status.paid {
    flex-wrap: wrap;
    gap: var(--nv-space-1) var(--nv-space-2);
  }

  .slug-status.paid::before {
    display: none;
  }

  /* The price is a quiet tag beside «Купить» (the one orange thing here), its figure tabular. */
  .slug-status.paid > .chip {
    border-color: var(--nv-line-strong);
    background: var(--nv-surface-2);
    color: var(--nv-text);
    font-variant-numeric: tabular-nums;
  }

  .slug-status-note {
    flex-basis: 100%;
    color: var(--nv-text-3);
    line-height: 1.45;
  }

  /* r180: phones put nova-link.lol/ on its own row, so the address itself gets the full width. */
  @container ed (max-width: 420px) {
    .ed-slug .slug-field {
      flex-wrap: wrap;
      row-gap: 0;
    }

    .ed-slug .slug-field > .input-prefix {
      flex: 1 0 100%;
      max-width: none;
      min-height: 24px;
      padding: var(--nv-space-1) var(--nv-space-3) 0;
      font-size: var(--nv-fs-12);
    }

    .ed-slug .slug-field > input {
      padding-left: var(--nv-space-3);
    }

    .ed-slug .slug-field > .ed-slug-btn:nth-last-child(2) {
      display: none;
    }
  }

  /* ---- Asset tiles (avatar, background, cursor) ---------------------------- */
  .ed-asset {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--nv-space-4);
    min-width: 0;
    padding: var(--nv-space-3);
    border: 1px dashed var(--nv-line-strong);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    transition: border-color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-asset:hover {
    border-color: var(--nv-field-line-hover);
  }

  .ed-asset.has-media {
    border-style: solid;
    border-color: var(--nv-line);
  }

  /* An empty slot is a plain well (no orange wash); 8px corners inside the 12px tile. */
  .ed-asset-thumb {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: calc(var(--nv-r-md) - 4px);
    background: var(--nv-bg-deep);
    color: var(--nv-text-3);
    box-shadow: inset 0 0 0 1px var(--nv-line);
  }

  .ed-asset-thumb > :is(img, video) {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .ed-asset-thumb .ed-ico {
    width: 24px;
    height: 24px;
  }

  .ed-asset.is-round .ed-asset-thumb {
    border-radius: 50%;
  }

  .ed-asset.is-wide .ed-asset-thumb {
    width: 128px;
  }

  .ed-asset.is-small .ed-asset-thumb {
    width: 56px;
    height: 56px;
    background: repeating-conic-gradient(var(--nv-surface-3) 0 25%, var(--nv-surface-2) 0 50%) 0 0 / 12px 12px;
  }

  .ed-asset.is-small .ed-asset-thumb > img {
    width: 60%;
    height: 60%;
    object-fit: contain;
  }

  .ed-asset.uploading .ed-asset-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 24px;
    height: 24px;
    border: 2px solid var(--nv-line-strong);
    border-top-color: var(--nv-accent);
    border-radius: 50%;
    animation: nv-spin .75s linear infinite;
  }

  .ed-asset-badge {
    position: absolute;
    left: var(--nv-space-1);
    bottom: var(--nv-space-1);
    padding: 2px 6px;
    border-radius: var(--nv-r-xs);
    background: rgba(5, 4, 3, .78);
    color: var(--nv-text);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
    line-height: 1.2;
  }

  .ed-asset-body {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .ed-asset-body > b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .ed-asset-body > small {
    overflow: hidden;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ed-asset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nv-space-2);
    margin-top: var(--nv-space-2);
  }

  .ed-asset-actions .ed-ico,
  .ed-banner-bar .ed-ico,
  .ed-tracks-actions .ed-ico {
    width: 16px;
    height: 16px;
  }

  .ed-rights-row {
    display: flex;
    align-items: flex-start;
    gap: var(--nv-space-3);
    padding: var(--nv-space-3) var(--nv-space-4);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-1);
    cursor: pointer;
  }

  .ed-rights-row > input {
    margin-top: 2px;
  }

  .ed-rights-row > span {
    display: grid;
    gap: 2px;
  }

  .ed-rights-row b {
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
  }

  .ed-rights-row small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    line-height: 1.45;
  }

  /* ---- Banner -------------------------------------------------------------- */
  .ed-banner {
    display: grid;
    gap: var(--nv-space-3);
  }

  .ed-banner-frame {
    display: grid;
    place-items: center;
    overflow: hidden;
    aspect-ratio: 3 / 1;
    border: 1px dashed var(--nv-line-strong);
    border-radius: var(--nv-r-md);
    background: var(--nv-bg-deep);
  }

  .ed-banner.has-media .ed-banner-frame {
    border-style: solid;
    border-color: var(--nv-line);
  }

  .ed-banner-frame > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .ed-banner-empty {
    display: grid;
    justify-items: center;
    gap: var(--nv-space-1);
    color: var(--nv-text-3);
    text-align: center;
  }

  .ed-banner-empty .ed-ico {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
  }

  .ed-banner-empty b {
    color: var(--nv-text-2);
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-13);
  }

  .ed-banner-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
  }

  .ed-banner-status {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .ed-banner.uploading .ed-banner-frame {
    opacity: .6;
  }

  /* ---- Music playlist ------------------------------------------------------ */
  .ed-tracks {
    display: grid;
    gap: 12px;
  }

  .ed-track-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ed-track-list:empty {
    display: none;
  }

  .ed-track {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: var(--nv-space-2);
    padding: var(--nv-space-1) var(--nv-space-2) var(--nv-space-1) var(--nv-space-1);
  }

  .ed-track-cover-wrap {
    position: relative;
  }

  /* An empty cover is a plain step with a muted note icon (no orange gradient, no halo on hover). */
  .ed-track-cover {
    position: relative;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    overflow: hidden;
    border-radius: calc(var(--nv-r-md) - 4px);
    background: var(--nv-surface-3);
    color: var(--nv-text-3);
    box-shadow: inset 0 0 0 1px var(--nv-line);
    transition: color var(--nv-dur-1) var(--nv-ease), background-color var(--nv-dur-1) var(--nv-ease);
  }

  .ed-track-cover:hover {
    background: var(--nv-surface-4);
    color: var(--nv-text);
  }

  .ed-track-cover > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--nv-dur-1) var(--nv-ease);
  }

  .ed-track-cover:hover > img {
    opacity: .8;
  }

  .ed-track-num {
    position: absolute;
    left: var(--nv-space-1);
    bottom: 2px;
    color: var(--nv-text);
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  }

  .ed-track-cover-x {
    position: absolute;
    top: -8px;
    right: -8px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--nv-line-strong);
    border-radius: 50%;
    background: var(--nv-surface-4);
    color: var(--nv-text-2);
  }

  .ed-track-cover-x:hover {
    color: var(--nv-danger);
  }

  .ed-track-cover-x .ed-ico {
    width: 12px;
    height: 12px;
    stroke-width: 2;
  }

  .ed-track-fields {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .ed-track-fields > input {
    min-height: 32px;
    padding: 0 var(--nv-space-2);
    border-color: transparent;
    background-color: transparent;
    box-shadow: none;
  }

  .ed-track-fields > input:hover {
    border-color: var(--nv-field-line);
    background-color: var(--nv-field);
  }

  .ed-track-fields > input:focus {
    border-color: var(--nv-accent);
    background-color: var(--nv-field);
  }

  .ed-track-title {
    color: var(--nv-text);
    font-weight: var(--nv-fw-medium);
  }

  .ed-track-artist {
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
  }

  .ed-track-actions {
    display: flex;
    gap: 2px;
  }

  .ed-track-play[aria-pressed="true"] {
    background: var(--nv-accent-soft);
    color: var(--nv-accent-text);
  }

  .ed-track-actions .ed-ico {
    width: 16px;
    height: 16px;
  }

  .ed-tracks-empty {
    display: flex;
    align-items: center;
    gap: var(--nv-space-3);
    padding: var(--nv-space-4);
    border: 1px dashed var(--nv-line-strong);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .ed-tracks-empty[hidden] {
    display: none;
  }

  .ed-tracks-empty > span:last-child {
    display: grid;
    gap: 2px;
  }

  .ed-tracks-empty b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .ed-tracks-empty small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  /* r181: the note sits bare in the muted role (no tinted tile). */
  .ed-tracks-empty-icon {
    display: grid;
    place-items: center;
    flex: none;
    color: var(--nv-text-3);
  }

  .ed-tracks-empty-icon .ed-ico {
    width: 24px;
    height: 24px;
  }

  .ed-tracks-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .ed-tracks-legacy {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .ed-tracks-count {
    margin-left: auto;
    color: var(--nv-text-3);
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-12);
    font-variant-numeric: tabular-nums;
  }

  .ed-tracks-status {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .ed-tracks-status:empty {
    display: none;
  }

  .ed-tracks.is-busy .ed-track-list {
    opacity: .7;
  }

  @container ed (max-width: 460px) {
    .ed-track {
      grid-template-columns: auto auto minmax(0, 1fr);
    }

    .ed-track-actions {
      grid-column: 3;
      justify-content: flex-end;
      margin-top: -4px;
    }
  }

  /* ---- Media library, YouTube panel, catalog -------------------------------- */
  .ed-library {
    display: grid;
    gap: var(--nv-space-3);
  }

  .library-picker {
    display: grid;
    gap: var(--nv-space-2);
  }

  .library-picker:empty {
    display: none;
  }

  .ed-library-row,
  .ed-version {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-2) var(--nv-space-3);
    padding: var(--nv-space-2) var(--nv-space-3);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .ed-library-row > div:first-of-type,
  .ed-version > div:first-child {
    display: grid;
    gap: 2px;
    flex: 1 1 180px;
    min-width: 0;
  }

  .ed-library-row b,
  .ed-version b {
    overflow: hidden;
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ed-library-row small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  /* r181: a bare muted icon in one column (no tinted tile). */
  .ed-library-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    color: var(--nv-text-3);
  }

  .library-file-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--nv-space-2);
  }

  .library-file-actions > select {
    width: auto;
    min-height: 32px;
    font-size: var(--nv-fs-13);
  }

  .ed-version-list,
  .ed-library-pick {
    display: grid;
    gap: 8px;
  }

  .editor-media-empty {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-13);
  }

  .ed-disclosure > summary {
    min-height: 48px;
    padding: var(--nv-space-3) 44px var(--nv-space-3) var(--nv-space-4);
    font-size: var(--nv-fs-14);
  }

  .ed-disclosure > summary .ed-ico {
    width: 16px;
    height: 16px;
    color: var(--nv-text-3);
  }

  .ed-disclosure > div {
    padding: 0 var(--nv-space-4) var(--nv-space-4);
  }

  .youtube-media-panel {
    display: grid;
    gap: var(--nv-space-3);
  }

  .youtube-media-head {
    display: none;
  }

  .youtube-url {
    display: grid;
    gap: var(--nv-space-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
    font-weight: var(--nv-fw-medium);
  }

  .youtube-url > div {
    display: flex;
    gap: var(--nv-space-2);
  }

  .youtube-check-result {
    display: flex;
    align-items: flex-start;
    gap: var(--nv-space-3);
    padding: var(--nv-space-3);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-sm);
    background: var(--nv-surface-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
    line-height: 1.45;
  }

  .youtube-check-result > img {
    flex: none;
    width: 96px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    object-fit: cover;
  }

  .youtube-check-result > div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .youtube-check-result b {
    color: var(--nv-text);
  }

  .youtube-check-result.warning {
    border-color: var(--nv-warning-line);
  }

  .youtube-check-result.error {
    border-color: var(--nv-danger-line);
    color: var(--nv-danger);
  }

  .youtube-media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .copyright-note {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    line-height: 1.5;
  }

  .copyright-note b {
    color: var(--nv-text-2);
  }

  .media-catalog {
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-1);
  }

  .media-catalog-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-3);
    min-height: 48px;
    padding: var(--nv-space-3) var(--nv-space-4);
    list-style: none;
    cursor: pointer;
  }

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

  .media-catalog-summary > span {
    display: grid;
    gap: 2px;
  }

  .media-catalog-summary b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .media-catalog-summary small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .media-catalog-summary > i {
    display: none;
  }

  .media-catalog-summary::after {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-right: var(--nv-space-2);
    border-right: 2px solid var(--nv-text-3);
    border-bottom: 2px solid var(--nv-text-3);
    transform: translateY(-2px) rotate(45deg);
    transition: transform var(--nv-dur-2) var(--nv-ease);
  }

  .media-catalog[open] .media-catalog-summary::after {
    transform: translateY(2px) rotate(-135deg);
  }

  .media-catalog-body {
    display: grid;
    gap: var(--nv-space-3);
    padding: 0 var(--nv-space-4) var(--nv-space-4);
  }

  .media-catalog-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-3);
  }

  .media-catalog-head > div:first-child {
    display: grid;
  }

  .media-catalog-head small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .media-catalog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--nv-space-2);
  }

  .catalog-card {
    display: grid;
    gap: var(--nv-space-2);
    align-content: start;
    min-width: 0;
    padding: var(--nv-space-1) var(--nv-space-1) var(--nv-space-3);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .catalog-card > div:nth-child(2) {
    display: grid;
    gap: 2px;
    padding: 0 4px;
  }

  .catalog-card b {
    display: -webkit-box;
    overflow: hidden;
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .catalog-card small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .catalog-card > button {
    --btn-h: 32px;
    margin: 0 4px;
    font-size: var(--nv-fs-13);
  }

  .catalog-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: calc(var(--nv-r-md) - 4px);
    background: var(--nv-bg-deep);
  }

  .catalog-thumb > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .catalog-thumb > span {
    position: absolute;
    left: var(--nv-space-2);
    top: var(--nv-space-2);
    padding: 2px 6px;
    border-radius: var(--nv-r-xs);
    background: rgba(5, 4, 3, .75);
    color: var(--nv-text);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
    line-height: 1.2;
  }

  .catalog-more {
    justify-self: center;
  }

  .catalog-empty,
  .catalog-loading {
    display: grid;
    gap: var(--nv-space-2);
    justify-items: start;
    padding: var(--nv-space-3) 0;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-13);
  }

  /* ---- Discord presence, clock, embed preview ------------------------------ */
  /* How-to steps: a plain nested panel (no info-blue tint); the icon stays muted, the title primary. */
  .ed-steps {
    padding: var(--nv-space-4);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .ed-steps-title {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    font-weight: var(--nv-fw-medium);
  }

  .ed-steps-title .ed-ico {
    width: 16px;
    height: 16px;
    color: var(--nv-text-3);
  }

  .ed-steps ol {
    display: grid;
    gap: var(--nv-space-3);
    margin: var(--nv-space-3) 0 0;
    padding: 0;
    list-style: none;
  }

  .ed-steps li {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--nv-space-1) var(--nv-space-3);
  }

  .ed-steps li > span:nth-child(2) {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .ed-steps li b {
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
  }

  .ed-steps li small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    line-height: 1.4;
  }

  .ed-step-dot {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--nv-line-strong);
    border-radius: 50%;
    background: var(--nv-surface-3);
    color: var(--nv-text-2);
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
  }

  .ed-steps li.is-done .ed-step-dot {
    border-color: var(--nv-success-line);
    background: var(--nv-success-soft);
    color: var(--nv-success);
  }

  /* The stroke exception: a 12px glyph in a disc (see .ed-visual-check). */
  .ed-steps li.is-done .ed-step-dot .ed-ico {
    width: 12px;
    height: 12px;
    stroke-width: 2;
  }

  .ed-steps li > :is(button, a) {
    --btn-h: 32px;
    white-space: nowrap;
  }

  .ed-steps li > a .ed-ico {
    width: 16px;
    height: 16px;
  }

  .ed-presence-result {
    margin-top: var(--nv-space-3);
    padding: var(--nv-space-2) var(--nv-space-3);
    border-radius: var(--nv-r-sm);
    background: var(--nv-surface-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
  }

  .ed-presence-result[data-tone="success"] { background: var(--nv-success-soft); color: var(--nv-success); }
  .ed-presence-result[data-tone="warning"] { background: var(--nv-warning-soft); color: var(--nv-warning); }
  .ed-presence-result[data-tone="error"] { background: var(--nv-danger-soft); color: var(--nv-danger); }

  @container ed (max-width: 520px) {
    .ed-steps li {
      grid-template-columns: 24px minmax(0, 1fr);
    }

    .ed-steps li > :is(button, a) {
      grid-column: 2;
      justify-self: start;
    }
  }

  .ed-clock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--nv-space-3);
    padding: var(--nv-space-3) var(--nv-space-4);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  /* A still, line-drawn clock face in the muted role (no orange ring, no glow, no spinning hand). */
  .ed-clock-face {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    border: 2px solid var(--nv-text-3);
    border-radius: 50%;
  }

  .ed-clock-face::before,
  .ed-clock-face::after {
    content: "";
    position: absolute;
    left: calc(50% - 1px);
    bottom: 50%;
    width: 2px;
    border-radius: 2px;
    background: var(--nv-text);
    transform-origin: bottom center;
  }

  .ed-clock-face::before {
    height: 10px;
    transform: rotate(-40deg);
  }

  .ed-clock-face::after {
    height: 14px;
    transform: rotate(60deg);
  }

  .ed-clock-text {
    display: grid;
    flex: 1 1 140px;
    min-width: 0;
  }

  .ed-clock-text b {
    color: var(--nv-text);
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-18);
    font-variant-numeric: tabular-nums;
  }

  .ed-clock-text small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .ed-seo {
    display: grid;
    gap: var(--nv-space-5);
  }

  .ed-embed-shell {
    display: grid;
    gap: var(--nv-space-2);
  }

  /* Sentence-case label like every other section label (was an uppercase tracked eyebrow). */
  .ed-embed-eyebrow {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-eyebrow);
    font-weight: var(--nv-fw-medium);
    letter-spacing: 0;
  }

  /* The Discord mock keeps Discord's own link blue (it shows how the link really looks there). */
  .ed-discord {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: var(--nv-space-3);
    padding: var(--nv-space-4);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .ed-discord-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--nv-surface-4);
  }

  .ed-discord-msg {
    display: grid;
    gap: var(--nv-space-1);
    min-width: 0;
  }

  .ed-discord-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .ed-discord-meta b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .ed-discord-meta small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .ed-discord-link {
    overflow-wrap: anywhere;
    color: var(--nv-info);
    font-size: var(--nv-fs-14);
  }

  .ed-embed {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: var(--nv-space-4);
    max-width: 440px;
    margin-top: var(--nv-space-1);
    padding: var(--nv-space-3) var(--nv-space-4) var(--nv-space-4);
    border-left: 4px solid var(--embed);
    border-radius: 4px;
    background: var(--nv-surface-3);
  }

  .ed-embed-text {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .ed-embed-text small {
    color: var(--nv-text-2);
    font-size: var(--nv-fs-12);
  }

  .ed-embed-text b {
    color: var(--nv-info);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
    line-height: 1.3;
  }

  .ed-embed-text p {
    display: -webkit-box;
    overflow: hidden;
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
    line-height: 1.45;
    white-space: pre-line;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }

  .ed-embed-thumb {
    width: 72px;
    height: 72px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--nv-surface-2);
  }

  /* r180: phones stack the thumbnail above the text (beside it the text got one word per line). */
  @container ed (max-width: 380px) {
    .ed-embed {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--nv-space-3);
    }

    .ed-embed-thumb {
      order: -1;
    }
  }

  .ed-embed-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    line-height: 1.45;
  }

  /* ---- Live preview column ------------------------------------------------- */
  .preview-wrap {
    grid-area: preview;
    display: none;
    min-width: 0;
  }

  @container ed (min-width: 700px) {
    .preview-wrap {
      position: sticky;
      top: var(--ed-preview-top);
      display: flex;
      flex-direction: column;
      gap: var(--nv-space-3);
      /* r180: never taller than the room between the toolbar and the tab bar (landscape phones). */
      height: calc(100dvh - var(--ed-preview-top) - var(--ed-bottom, 0px) - var(--nv-space-4));
      min-height: min(480px, calc(100dvh - var(--ed-preview-top) - var(--ed-bottom, 0px) - var(--nv-space-4)));
      padding: var(--nv-space-3) var(--nv-space-3) var(--nv-space-4);
      border: 1px solid var(--nv-line);
      border-radius: var(--nv-r-xl);
      background: var(--nv-surface-1);
    }
  }

  /* The column around the live page is quiet chrome: the page itself is the colour on this screen. */
  .preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-2);
    padding: 0 0 0 var(--nv-space-1);
  }

  .preview-toolbar > div:first-child {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  /* Block (not flex) so a narrow column ellipsizes the title instead of running under the actions. */
  .preview-toolbar > div:first-child > b {
    overflow: hidden;
    color: var(--nv-text);
    font-size: var(--nv-fs-13);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .preview-toolbar > div:first-child > b > .ed-live-dot {
    display: inline-block;
    margin: 0 var(--nv-space-2) 0 0;
    vertical-align: 1px;
  }

  .preview-toolbar > div:first-child > span {
    overflow: hidden;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* A plain, still status dot (no halo, no breathing loop). */
  .ed-live-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nv-success);
  }

  .preview-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: var(--nv-space-1);
  }

  .ed-device > button {
    padding: var(--nv-space-1) var(--nv-space-2);
  }

  .ed-device .ed-ico {
    width: 16px;
    height: 16px;
  }

  .ed-device > button > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .preview-actions > .icon-btn {
    --btn-h: 32px;
  }

  .ed-sheet-close {
    display: none;
  }

  .device-stage {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    min-height: 0;
    container-type: size;
  }

  /* The device is a real object (a tone shift inside one neutral, a lit top edge, a soft neutral shadow);
     no orange glow behind it: the page on its screen carries the colour. */
  .iphone-shell {
    position: relative;
    padding: 7px;
    border-radius: 46px;
    background: linear-gradient(150deg, var(--nv-surface-4), var(--nv-bg-deep) 60%, var(--nv-surface-3));
    box-shadow:
      0 0 0 1px var(--nv-line-strong),
      inset 0 1px 0 rgba(255, 245, 235, .12),
      0 34px 60px -24px rgba(0, 0, 0, .85);
    transition: border-radius var(--nv-dur-3) var(--nv-ease);
  }

  .iphone-shell > .side {
    position: absolute;
    width: 3px;
    border-radius: 2px;
    background: var(--nv-surface-4);
  }

  .iphone-shell > .side.power {
    right: -3px;
    top: 22%;
    height: 9%;
  }

  .iphone-shell > .side.volume-up {
    left: -3px;
    top: 18%;
    height: 6%;
  }

  .iphone-shell > .side.volume-down {
    left: -3px;
    top: 26%;
    height: 6%;
  }

  .iphone-screen {
    position: relative;
    width: min(calc(100cqw - 20px), calc((100cqh - 20px) * 390 / 844));
    aspect-ratio: 390 / 844;
    overflow: hidden;
    border-radius: 39px;
    background: var(--nv-bg-deep);
    isolation: isolate;
  }

  .unified-preview > :not(.profile-preview-frame) {
    display: none;
  }

  .profile-preview-frame {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    max-width: none;
    border: 0;
    background: transparent;
  }

  .iphone-shell.desktop-mode {
    padding: 5px;
    border-radius: 14px;
  }

  .iphone-shell.desktop-mode > .side {
    display: none;
  }

  .iphone-shell.desktop-mode .iphone-screen {
    width: min(calc(100cqw - 14px), calc((100cqh - 14px) * 16 / 9));
    aspect-ratio: 16 / 9;
    border-radius: 9px;
  }

  /* ---- Narrow screens: floating preview button, sheet, bottom bar ---------- */
  .ed-fab {
    position: fixed;
    right: max(var(--nv-space-4), env(safe-area-inset-right));
    bottom: max(var(--nv-space-5), env(safe-area-inset-bottom));
    z-index: var(--nv-z-header);
    display: inline-flex;
    align-items: center;
    gap: var(--nv-space-2);
    height: 48px;
    padding: 0 var(--nv-space-5) 0 var(--nv-space-4);
    border: 1px solid var(--nv-line-strong);
    border-radius: var(--nv-r-control);
    background: var(--nv-surface-2);
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
    box-shadow: var(--nv-shadow-2);
    transition: background-color var(--nv-dur-1) var(--nv-ease), transform var(--nv-dur-1) var(--nv-ease);
  }

  .ed-fab:hover {
    background: var(--nv-surface-3);
  }

  .ed-fab:active {
    transform: scale(var(--nv-press-scale));
  }

  .ed-fab .ed-ico {
    color: var(--nv-text-2);
  }

  .ed-mobilebar {
    display: none;
  }

  /* Phones/tablets have the app's bottom tab bar (app-shell.css, <=900px): sit above it. */
  @media (max-width: 900px) {
    .ed-page {
      --ed-bottom: var(--nv-tabbar-h, calc(64px + env(safe-area-inset-bottom)));
    }

    .ed-fab {
      bottom: calc(var(--ed-bottom) + var(--nv-space-4));
    }
  }

  @container ed (min-width: 700px) {
    .ed-fab {
      display: none;
    }
  }

  @container ed (max-width: 599px) {
    .ed-shell {
      padding-bottom: 72px;
    }

    .ed-fab {
      display: none;
    }

    /* Solid like the tab bar under it (no glass, no shadow): the canvas plus a hairline. */
    .ed-mobilebar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: var(--ed-bottom, 0px);
      z-index: var(--nv-z-header);
      display: flex;
      align-items: center;
      gap: var(--nv-space-2);
      padding: var(--nv-space-2) var(--nv-space-4);
      border-top: 1px solid var(--nv-line);
      background: var(--nv-bg);
    }

    .ed-mobilebar > button {
      --btn-h: var(--nv-hit);
      flex: none;
    }

    .ed-mobilebar > .primary {
      --btn-px: var(--nv-space-5);
    }
  }

  /* r164: the preview action keeps its label («Посмотреть страницу»); on phones the save state
     shrinks to its coloured dot (the text stays for screen readers and as a tooltip). */
  @container ed (max-width: 400px) {
    .ed-mobilebar > .ed-mobilebar-preview {
      --btn-px: 12px;
      flex: 1 1 auto;
      min-width: 0;
    }

    .ed-mobilebar > .ed-mobilebar-preview > span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .ed-mobilebar > .primary {
      --btn-px: 16px;
    }

    .ed-mobilebar > .ed-mobilebar-status {
      flex: none;
      width: 16px;
      padding-left: var(--nv-space-1);
    }

    /* r166 (E1): when everything is published the button itself says «Опубликовано»: no extra green dot. */
    .ed-mobilebar > .ed-mobilebar-status:is([data-state="published"], [data-state="idle"]) {
      display: none;
    }
  }

  /* 360px phones: both labels still fit in full. */
  @container ed (max-width: 340px) {
    .ed-mobilebar > :is(.ed-mobilebar-preview, .primary) {
      --btn-px: var(--nv-space-2);
      gap: var(--nv-space-1);
      font-size: var(--nv-fs-13);
    }
  }

  .ed-mobilebar-status {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    gap: var(--nv-space-2);
    min-width: 0;
    overflow: hidden;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-regular);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ed-mobilebar-status::before {
    content: "";
  }

  /* r180: after a failed save the status is the retry (or sign-in) button (studio.js renderPill). */
  .ed-mobilebar-status[role="button"] {
    min-height: var(--nv-hit);
    cursor: pointer;
  }

  @container ed (max-width: 400px) {
    .ed-mobilebar > .ed-mobilebar-status[role="button"] {
      justify-content: center;
      width: var(--nv-hit);
      gap: 0;
      padding: 0;
      border-radius: 50%;
      background: var(--nv-surface-2);
      box-shadow: inset 0 0 0 1px var(--nv-line-strong);
      font-size: 0;
    }

    .ed-mobilebar:has(> .ed-mobilebar-status[role="button"]) > .ed-mobilebar-preview > .ed-ico {
      display: none;
    }
  }

  /* Full-screen preview sheet (only ever opened below the two-column width). */
  .ed-page[data-mobile-view="preview"] .preview-wrap {
    position: fixed;
    inset: 0;
    z-index: var(--nv-z-overlay);
    display: flex;
    flex-direction: column;
    gap: var(--nv-space-3);
    padding: max(12px, env(safe-area-inset-top)) var(--nv-space-4) max(16px, env(safe-area-inset-bottom));
    background: var(--nv-bg);
    animation: ed-sheet-in var(--nv-dur-3) var(--nv-ease);
  }

  .ed-page[data-mobile-view="preview"] .ed-sheet-close {
    display: inline-flex;
    --btn-h: var(--nv-hit);
  }

  .ed-page[data-mobile-view="preview"] :is(.ed-fab, .ed-mobilebar) {
    display: none;
  }

  .ed-sheet-open,
  .ed-sheet-open body {
    overflow: hidden;
  }

  /* ---- Overview checklist (studio.js renders it on the overview page) ------ */
  .profile-checklist {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-3) var(--nv-space-5);
    margin: var(--nv-space-4) 0;
    padding: var(--nv-space-4) var(--nv-space-5);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-lg);
    background: var(--nv-surface-1);
  }

  .profile-checklist:empty {
    display: none;
  }

  .profile-checklist > div:first-child {
    display: grid;
    gap: 2px;
  }

  .profile-checklist > div:first-child b {
    color: var(--nv-text);
    font-size: var(--nv-fs-16);
  }

  .profile-checklist > div:first-child small {
    color: var(--nv-text-3);
  }

  .checklist-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nv-space-2);
  }

  .checklist-items > button {
    display: inline-flex;
    align-items: center;
    gap: var(--nv-space-2);
    min-height: 36px;
    padding: 0 var(--nv-space-3);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-control);
    background: var(--nv-surface-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
    font-weight: var(--nv-fw-medium);
    transition: border-color var(--nv-dur-1) var(--nv-ease), color var(--nv-dur-1) var(--nv-ease);
  }

  .checklist-items > button > svg {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--nv-text-3);
  }

  .checklist-items > button:hover {
    border-color: var(--nv-line-strong);
    color: var(--nv-text);
  }

  /* A finished step steps back: muted label, the check alone carries the green. */
  .checklist-items > button.done {
    color: var(--nv-text-3);
  }

  .checklist-items > button.done > svg {
    color: var(--nv-success);
  }

  /* ---- Phones: compact + calm (r160) ---------------------------------------
     The tab strip becomes a flush, quiet band under the top bar; cards, pickers and
     the bottom action bar get tighter; visual pickers run three across; selected
     tiles lose their orange glow. Media query (not the container) so desktop is untouched. */
  @media (max-width: 640px) {
    .ed-shell {
      --ed-sticky-top: var(--nv-topbar-h);
      --ed-toolbar-h: 52px;
    }

    /* Flush, solid band under the top bar (no glass). */
    .ed-toolbar {
      min-height: var(--ed-toolbar-h);
      margin: calc(-1 * var(--nv-space-4)) calc(-1 * var(--nv-space-4)) var(--nv-space-3);
      padding: var(--nv-space-1) var(--nv-space-2);
      border-width: 0 0 1px;
      border-color: var(--nv-line-soft);
      border-radius: 0;
      background: var(--nv-bg);
    }

    .ed-tools::before {
      content: none;
    }

    /* r166 (G4): all six sections at once — a 3-column grid instead of a scroller that hid
       «Виджеты» and «Превью ссылок» off-screen. Labels only; a long one wraps to two lines.
       r181: the current one is the same surface step with a hairline as on desktop. */
    .ed-tabs {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--nv-space-1);
      padding-right: 0;
      overflow: visible;
      -webkit-mask-image: none;
      mask-image: none;
    }

    .ed-tabs > [role="tab"] {
      justify-content: center;
      min-height: 36px;
      padding: 2px var(--nv-space-1);
      line-height: 1.15;
      text-align: center;
      white-space: normal;
      text-wrap: balance;
    }

    .ed-tabs > [role="tab"] .ed-ico {
      display: none;
    }

    .ed-panels,
    .ed-panel {
      gap: var(--nv-space-3);
    }

    .ed-card {
      padding: var(--nv-space-3);
    }

    .ed-card-head p {
      font-size: var(--nv-fs-12);
    }

    .ed-card-body,
    .ed-fields,
    .ed-grid-2 {
      gap: var(--nv-space-3);
    }

    .ed-card-body {
      margin-top: var(--nv-space-3);
    }

    /* Pickers: three across; the chosen tile keeps a 1px accent border and its check (no rim). */
    .ed-visuals,
    .ed-visuals-font,
    .ed-visuals-nick {
      grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
      gap: var(--nv-space-2);
    }

    .ed-visual {
      gap: var(--nv-space-1);
      padding: var(--nv-space-1) var(--nv-space-1) var(--nv-space-2);
      border-radius: var(--nv-r-sm);
    }

    .ed-visual-label {
      font-size: var(--nv-fs-12);
    }

    .ed-visual-lock {
      width: 20px;
      height: 20px;
    }

    .ed-art {
      border-radius: var(--nv-r-xs);
    }

    .ed-visual[aria-checked="true"] {
      box-shadow: none;
    }

    .ed-presets {
      grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
      gap: var(--nv-space-2);
    }

    .ed-preset {
      gap: var(--nv-space-2);
      padding: var(--nv-space-1) var(--nv-space-1) var(--nv-space-2);
      border-radius: var(--nv-r-sm);
    }

    .ed-preset[aria-checked="true"] {
      box-shadow: none;
    }

    .ed-preset-art {
      aspect-ratio: 1;
      border-radius: var(--nv-r-xs);
    }

    .ed-preset-card {
      width: 70%;
      padding: 7px 6px 8px;
    }

    .ed-preset-meta b {
      font-size: var(--nv-fs-12);
    }

    /* r166 (E3, G2): captions are 12px and may take two lines instead of «Северное сиян…». */
    .ed-preset-meta small {
      display: -webkit-box;
      overflow: hidden;
      font-size: var(--nv-fs-12);
      line-height: 1.25;
      white-space: normal;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    .ed-visual-label > span:first-child {
      overflow-wrap: anywhere;
      hyphens: auto;
    }

    /* r166 (E2): ten colour swatches as two even rows of five, each a full 44px target. */
    .ed-swatches {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: var(--nv-space-3);
    }

    .ed-quick-swatch {
      justify-self: center;
      width: 100%;
      max-width: var(--nv-hit);
      height: auto;
      aspect-ratio: 1;
    }

    /* A 262px card at 320: (262 - 4 x 8) / 5 = 46, so every swatch keeps its full 44px. */
    @media (max-width: 360px) {
      .ed-swatches {
        gap: var(--nv-space-2);
      }
    }

    .ed-preset-active {
      top: 8px;
      right: 8px;
    }

    /* Bottom action bar: one compact solid band right on top of the tab bar (53px: a 44px row + 4px). */
    .ed-shell {
      padding-bottom: 56px;
    }

    .ed-mobilebar {
      gap: var(--nv-space-2);
      padding: var(--nv-space-1) var(--nv-space-4);
      border-top-color: var(--nv-line-soft);
    }

    /* Preview sheet */
    .ed-page[data-mobile-view="preview"] .preview-wrap {
      gap: var(--nv-space-2);
      padding-inline: var(--nv-space-3);
    }

    .iphone-shell {
      box-shadow:
        0 0 0 1px var(--nv-line-strong),
        inset 0 1px 0 rgba(255, 245, 235, .08),
        0 24px 48px -24px rgba(0, 0, 0, .8);
    }

    /* r166 (E5): on a phone the sheet IS the phone — no drawn bezel, no phone/computer toggle, the page
       uses the whole width. */
    .ed-page[data-mobile-view="preview"] :is(.ed-device, .preview-toolbar > div:first-child > span) {
      display: none;
    }

    .ed-page[data-mobile-view="preview"] .iphone-shell:not(.desktop-mode) {
      padding: 0;
      border-radius: var(--nv-r-lg);
      background: none;
      box-shadow: 0 0 0 1px var(--nv-line);
    }

    .ed-page[data-mobile-view="preview"] .iphone-shell:not(.desktop-mode) > .side {
      display: none;
    }

    .ed-page[data-mobile-view="preview"] .iphone-shell:not(.desktop-mode) .iphone-screen {
      width: min(100cqw, calc(100cqh * 390 / 844));
      border-radius: var(--nv-r-lg);
    }

    .profile-checklist {
      gap: var(--nv-space-3) var(--nv-space-4);
      margin: var(--nv-space-3) 0;
      padding: var(--nv-space-3) var(--nv-space-4);
    }
  }

  /* r181: on a short phone (≤600px tall, e.g. 320×568) the section grid scrolls away with the page instead of
     sticking under the top bar, like r180 does for landscape phones: 85px more for the fields. */
  @media (max-width: 640px) and (max-height: 600px) {
    .ed-toolbar {
      position: relative;
      top: 0;
    }
  }

  /* ---- r180: touch ------------------------------------------------------------
     Small editor controls get touch sizes. On a short screen (landscape phone) the toolbar scrolls with the
     page instead of sticking, and the live preview sticks right under the top bar. */
  @media (pointer: coarse) {
    .ed-color {
      padding-block: 0;
    }

    .ed-hex {
      min-height: calc(var(--nv-hit) - 2px);
    }

    .ed-auto,
    .ed-track-fields > input {
      min-height: var(--nv-h-sm);
    }

    .ed-sound-test {
      --btn-h: var(--nv-h-sm);
    }

    .ed-locked-open {
      display: inline-block;
      padding-block: 12px;
      margin-block: -12px;
    }

    /* r181: the toolbar and preview icon buttons are full touch targets too (the 56px bar has the room). */
    .ed-tools > .icon-btn,
    .preview-actions > .icon-btn {
      --btn-h: var(--nv-hit);
    }
  }

  @media (pointer: coarse) and (max-height: 520px) {
    .ed-shell {
      --ed-preview-top: calc(var(--ed-sticky-top) + var(--nv-space-2));
    }

    /* relative, not static: it keeps its z-index, so the ⋯ menu stays above the preview column */
    .ed-toolbar {
      position: relative;
      top: 0;
    }

    .ed-tools::before {
      content: none;
    }
  }

  /* r180: 320px phones: «Посмотреть страницу» keeps its whole label (the eye icon gives way), also beside the
     save-state dot. */
  @container ed (max-width: 300px) {
    .ed-mobilebar {
      padding-inline: var(--nv-space-3);
    }

    .ed-mobilebar > .ed-mobilebar-preview {
      --btn-px: 8px;
    }

    .ed-mobilebar > .ed-mobilebar-preview > .ed-ico {
      display: none;
    }
  }

  /* ---- Motion --------------------------------------------------------------- */
  @keyframes ed-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  @keyframes ed-field-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  @keyframes ed-sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  /* A card you were sent to: its hairline turns accent for a moment, then settles (no glow). */
  @keyframes ed-flash {
    0%, 35% { border-color: var(--nv-accent-line); }
    100% { border-color: var(--nv-line); }
  }
  @keyframes ed-drift { from { transform: translate(-6%, -4%) rotate(0deg); } to { transform: translate(6%, 5%) rotate(12deg); } }
  @keyframes ed-aurora { from { transform: skewY(-14deg) translateX(-12%); } to { transform: skewY(-8deg) translateX(12%); } }
  @keyframes ed-grain { 0% { transform: translate(0, 0); } 50% { transform: translate(-6px, 4px); } 100% { transform: translate(4px, -5px); } }
  @keyframes ed-rise { from { background-position-y: 0, 0; } to { background-position-y: -120px, -104px; } }
  @keyframes ed-fall { from { background-position-y: 0, 0; } to { background-position-y: 112px, 88px; } }
  @keyframes ed-rain { from { transform: translateY(0); } to { transform: translateY(26px); } }
  @keyframes ed-twinkle { from { opacity: .25; } to { opacity: 1; } }
  @keyframes ed-flicker { 0% { opacity: .9; } 100% { opacity: .6; } }
  @keyframes ed-roll { from { transform: translateY(-100%); } to { transform: translateY(380%); } }
  @keyframes ed-float { from { transform: translateY(3px); } to { transform: translateY(-4px); } }
  @keyframes ed-spin { to { transform: rotate(360deg); } }
  @keyframes ed-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
  @keyframes ed-type { 0% { clip-path: inset(0 100% 0 0); } 60%, 100% { clip-path: inset(0 0 0 0); } }
  @keyframes ed-blink { 50% { opacity: 0; } }
  @keyframes ed-shuffle { 0% { transform: translateY(0); opacity: 1; } 33% { transform: translateY(-3px); opacity: .5; } 66% { transform: translateY(2px) scaleX(-1); opacity: .8; } }
  @keyframes ed-jitter { 0% { transform: translate(.6px, -.4px); } 100% { transform: translate(-.6px, .5px); } }
  @keyframes ed-glitch { 0%, 88%, 100% { transform: none; clip-path: none; } 90% { transform: translateX(2px); clip-path: inset(10% 0 55% 0); } 94% { transform: translateX(-2px); clip-path: inset(50% 0 10% 0); } }
  @keyframes ed-neon { 0%, 40%, 44%, 100% { opacity: 1; } 42% { opacity: .55; } }
  @keyframes ed-wave { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } 60% { transform: translateY(2px); } }
  @keyframes ed-trail { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(4px, 3px); } }
  @keyframes ed-follow { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-5px, -3px); } }
  @keyframes ed-flame { from { transform: scale(1) translateY(0); opacity: .85; } to { transform: scale(1.08) translateY(-2px); opacity: 1; } }
  @keyframes ed-pulse-ring { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }
}
