body {
    margin: 0;
    padding-bottom: 46px; /* clearance for .sketch-toolbar */
}

.app-hidden {
    display: none;
}

.app-no-select {
    user-select: none;
}

.app-inline-title {
    display: inline-block;
    margin: 0 0.2em;
    font-weight: bold;
    line-height: 1;
    vertical-align: text-bottom;
}

#svgWrapper {
    width: 100%;
    overflow-x: hidden;
}

/* Object Timeline — draggable arrangement strip below the sketch */
.object-timeline {
    width: 100%;
    background: #1a1c22;
    border-top: 2px solid #2e3140;
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;
}

.object-timeline__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-bottom: 1px solid #2e3140;
}

.object-timeline__play {
    padding: 3px 10px;
    font-size: 11px;
    font-family: inherit;
    background: #2e3140;
    color: #b0bcd0;
    border: 1px solid #404660;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.4;
}

.object-timeline__play:hover {
    background: #3a3f58;
    color: #e0e8f4;
}

.object-timeline__play--active {
    background: #1a3a5c;
    color: #50c0ff;
    border-color: #2060a0;
}

.object-timeline__track {
    position: relative;
    width: 100%;
    min-height: 30px;
}

.object-timeline__region {
    position: absolute;
    background: color-mix(in srgb, var(--region-color, #50c080) 72%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--region-color, #50c080) 90%, #fff 10%);
    border-radius: 4px;
    box-sizing: border-box;
    cursor: grab;
    overflow: hidden;
    transition: box-shadow 0.1s;
    min-width: 6px;
}

.object-timeline__region:hover {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--region-color, #50c080) 80%, #fff 20%);
    z-index: 2;
}

.object-timeline__region--moved {
    border-style: dashed;
}

.object-timeline__region--playing {
    box-shadow: 0 0 0 2px #fff, 0 0 8px 2px color-mix(in srgb, var(--region-color, #50c080) 80%, #fff 20%);
    z-index: 5;
}

.object-timeline__region--dragging {
    cursor: grabbing;
    opacity: 0.85;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
    transition: none;
}

.object-timeline__region-label {
    display: block;
    padding: 2px 5px;
    font-size: 10px;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    pointer-events: none;
}

.object-timeline__region-handle {
    position: absolute;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    z-index: 2;
}
.object-timeline__region-handle--left { left: 0; }
.object-timeline__region-handle--right { right: 0; }
.object-timeline__region-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 55%;
    background: rgba(255,255,255,0.35);
    border-radius: 1px;
    pointer-events: none;
}
.object-timeline__region:hover .object-timeline__region-handle::after {
    background: rgba(255,255,255,0.65);
}

/* ── Embedder comparison panel ── */
.embedder-panel {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(10,16,26,0.85);
    border-top: 1px solid rgba(80,120,160,0.3);
}
.embedder-panel.app-hidden { display: none; }

.embedder-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(80,120,160,0.25);
    border-radius: 6px;
    min-width: 0;
}
.embedder-card--active {
    border-color: rgba(80,192,255,0.55);
    background: rgba(80,192,255,0.07);
}
.embedder-card--clap {
    border-color: rgba(160,100,220,0.35);
    border-left: 3px solid rgba(160,100,220,0.6);
    flex: 0 0 auto;
    min-width: 120px;
}

.embedder-card__title {
    font-size: 12px;
    font-weight: 600;
    color: #cde;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.embedder-card--active .embedder-card__title {
    color: #80d8ff;
}

.embedder-card__meta {
    font-size: 10px;
    color: rgba(180,200,220,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embedder-card__progress {
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.embedder-card__progress-bar {
    height: 100%;
    background: #50c0ff;
    transition: width 0.3s;
    border-radius: 2px;
}

.embedder-card__actions {
    display: flex;
    gap: 5px;
    margin-top: 2px;
}

.embedder-btn {
    flex: 1;
    padding: 3px 6px;
    font-size: 10px;
    border: 1px solid rgba(80,120,160,0.5);
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    color: #b0c8e0;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.embedder-btn:hover:not(:disabled) {
    background: rgba(80,192,255,0.15);
    border-color: rgba(80,192,255,0.5);
    color: #e0f4ff;
}
.embedder-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.embedder-btn--primary {
    background: rgba(80,192,255,0.18);
    border-color: rgba(80,192,255,0.45);
    color: #c0e8ff;
}
.embedder-btn--primary:hover:not(:disabled) {
    background: rgba(80,192,255,0.3);
}

.side-panel {
    position: fixed;
    top: 118px;
    bottom: 18px;
    z-index: 950;
    display: flex;
    pointer-events: none;
}

.side-panel--left {
    left: 0;
}

.side-panel--right {
    right: 0;
    flex-direction: row-reverse;
}

.side-panel__rail {
    width: 34px;
    min-height: 132px;
    align-self: flex-start;
    margin-top: 18px;
    border: 1px solid #d4dce8;
    background: rgba(255, 255, 255, 0.94);
    color: #172132;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    pointer-events: auto;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font: 800 13px/1 Roboto, sans-serif;
    letter-spacing: 0.02em;
}

.side-panel--left .side-panel__rail {
    border-radius: 0 8px 8px 0;
}

.side-panel--right .side-panel__rail {
    border-radius: 8px 0 0 8px;
}

.side-panel__body {
    box-sizing: border-box;
    width: min(380px, calc(100vw - 54px));
    height: 100%;
    overflow: hidden;
    border: 1px solid #d4dce8;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    pointer-events: auto;
    transition: transform 180ms ease;
    position: relative;
}

.side-panel--left .side-panel__body {
    border-left: 0;
    border-radius: 0 10px 10px 0;
}

.side-panel--right .side-panel__body {
    border-right: 0;
    border-radius: 10px 0 0 10px;
}

.side-panel--left.is-collapsed .side-panel__body {
    display: none;
}

.side-panel--right.is-collapsed .side-panel__body {
    display: none;
}

.side-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid #e3e9f1;
}

.side-panel__title {
    margin: 0;
    color: #111923;
    font-size: 16px;
    line-height: 1.15;
}

.side-panel__header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.side-panel__soundmap-btn {
    padding: 5px 11px;
    border: 1px solid #b8cce0;
    border-radius: 7px;
    background: #eef4fb;
    color: #1a3a5c;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.side-panel__soundmap-btn:hover {
    background: #ddeaf8;
    border-color: #7aadd8;
}

.side-panel__scroll-area {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.side-panel__scroll-area .examples-dropdown--panel {
    flex: 1;
    min-height: 0;
    height: auto;
    overflow-y: auto;
}

.side-panel__close {
    width: 30px;
    height: 30px;
    border: 1px solid #d4dce8;
    border-radius: 6px;
    background: #fff;
    color: #172132;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.inspector-content {
    overflow-y: auto;
    padding: 14px 16px 18px;
}

.inspector-content__empty {
    margin: 0;
    color: #586678;
    font-size: 13px;
    line-height: 1.45;
}

.inspector-card {
    display: grid;
    gap: 12px;
}

.inspector-card--remix {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e3e9f1;
}

.inspector-card__title {
    margin: 0;
    color: #111923;
    font-size: 17px;
    line-height: 1.2;
}

.inspector-card__facts {
    display: grid;
    gap: 7px;
    margin: 0;
}

.inspector-card__fact {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.35;
}

.inspector-card__label {
    color: #64748b;
    font-weight: 800;
}

.inspector-card__field {
    display: grid;
    gap: 6px;
}

.inspector-card__select {
    min-height: 34px;
    border: 1px solid #d6dee7;
    border-radius: 6px;
    padding: 0 9px;
    background: #fff;
    color: #172132;
    font: 800 12px/1.2 Roboto, sans-serif;
}

.inspector-card__actions {
    display: grid;
    gap: 7px;
}

.inspector-card__button {
    min-height: 34px;
    border: 1px solid #172132;
    border-radius: 6px;
    background: #172132;
    color: #fff;
    cursor: pointer;
    font: 800 12px/1.2 Roboto, sans-serif;
}

.inspector-card__button:hover {
    background: #2c394d;
}

.inspector-card__button--region {
    border-color: #d6dee7;
    background: #f8fafc;
    color: #16243a;
    text-align: left;
}

.inspector-card__button--region:hover {
    border-color: #8fa0b5;
    background: #eef5f7;
}

.inspector-card__button--chip {
    min-height: 30px;
    border-color: #d6dee7;
    background: #fff;
    color: #172132;
    font-size: 11px;
}

.inspector-card__button--chip:hover {
    border-color: #8fa0b5;
    background: #eef5f7;
}

.inspector-card__button--mini {
    min-height: 28px;
    padding: 0 9px;
    border-color: #d6dee7;
    background: #fff;
    color: #172132;
    font-size: 11px;
}

.inspector-card__button--mini:hover {
    border-color: #8fa0b5;
    background: #eef5f7;
}

.inspector-remix-directions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inspector-card__textarea {
    min-height: 118px;
    resize: vertical;
    border: 1px solid #d6dee7;
    border-radius: 6px;
    padding: 9px 10px;
    color: #172132;
    background: #f8fafc;
    font: 600 12px/1.45 Roboto, sans-serif;
}

.inspector-card__textarea--negative {
    min-height: 72px;
    background: #fff;
    color: #586678;
    font-size: 11px;
}

.inspector-card__link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #d6dee7;
    border-radius: 6px;
    background: #fff;
    color: #236b79;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.inspector-card__link:hover {
    border-color: #8fa0b5;
    background: #eef5f7;
}

.inspector-card__link--compact {
    min-height: 28px;
    width: max-content;
    font-size: 11px;
}

.inspector-remix-history {
    display: grid;
    gap: 8px;
    margin-top: 4px;
}

.inspector-remix-history__title {
    margin: 0;
    color: #172132;
    font-size: 12px;
    font-weight: 900;
}

.inspector-remix-preview {
    display: grid;
    gap: 7px;
    padding: 9px;
    border: 1px solid #d6dee7;
    border-radius: 6px;
    background: #f8fafc;
}

.inspector-remix-preview--variant {
    border-color: #88b8b4;
    background: #f2fbf8;
}

.inspector-remix-preview--history {
    border-color: #c7d9d7;
    background: #f6fbfa;
}

.inspector-remix-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #172132;
    font-size: 12px;
    font-weight: 900;
}

.inspector-remix-preview__meta {
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.inspector-remix-preview audio {
    width: 100%;
    height: 32px;
}

.inspector-remix-preview__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.inspector-remix-replacement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 9px;
    border: 1px solid #88b8b4;
    border-radius: 6px;
    background: #eef9f6;
    color: #16423f;
    font-size: 12px;
    font-weight: 900;
}

.objectifier-region--replaced {
    filter: drop-shadow(0 0 5px rgba(47, 127, 122, 0.75));
}

.inspector-axis-list {
    display: grid;
    gap: 9px;
}

.inspector-axis {
    display: grid;
    gap: 5px;
}

.inspector-axis__labels {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #586678;
    font-size: 11px;
    font-weight: 800;
}

.inspector-axis__track {
    position: relative;
    height: 7px;
    border-radius: 999px;
    background: #dce5ec;
}

.inspector-axis__track::before {
    content: "";
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: 50%;
    width: 1px;
    background: rgba(0, 0, 0, 0.24);
}

.inspector-axis__fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: #2f7f7a;
}

.inspector-axis__marker {
    position: absolute;
    top: 50%;
    width: 11px;
    height: 11px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #111923;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

/* ── Sketch modals ─────────────────────────────────────────────────────────── */

.sketch-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 20, 40, 0.55);
}

.sketch-modal[hidden] {
    display: none;
}

.sketch-modal__backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

.sketch-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
    width: 100%;
    max-width: 900px;
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sketch-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e3e9f1;
    flex-shrink: 0;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.sketch-modal__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #111923;
}

.sketch-modal__close {
    width: 30px;
    height: 30px;
    border: 1px solid #d4dce8;
    border-radius: 6px;
    background: #fff;
    color: #172132;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sketch-modal__close:hover {
    background: #f0f4f8;
}

.sketch-modal__body {
    overflow-y: auto;
    padding: 20px 24px 24px;
    flex: 1;
}

/* Reset the bottom-drawer wrapper styles inside modals */
.sketch-modal__body .selections__container {
    display: block;
    border: none;
    padding: 0;
}

body.sketch-modal-open {
    overflow: hidden;
}

/* ── Settings popover (Global Settings) ───────────────────────────────────── */

.sketch-popover {
    position: fixed;
    bottom: 54px;
    right: 16px;
    z-index: 1800;
    width: 260px;
    background: #fff;
    border: 1px solid #d4dce8;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 100px);
    overflow: hidden;
}

.sketch-popover[hidden] {
    display: none;
}

.sketch-popover__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #e3e9f1;
    background: #f8fafc;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}

.sketch-popover__title {
    font-size: 13px;
    font-weight: 700;
    color: #111923;
}

.sketch-popover__body {
    overflow-y: auto;
    padding: 10px 14px 14px;
}

.sketch-popover__body .global-settings__container {
    border: none;
    padding: 0;
    margin: 0;
}

.sketch-popover__body .global-settings__content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sketch-popover__body .global-settings__item {
    margin: 0;
}

.sketch-popover__body .global-settings__label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    cursor: pointer;
    padding: 3px 0;
}

/* ── Sketch toolbar ────────────────────────────────────────────────────────── */

.sketch-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    background: #f4f7fb;
    border-top: 1px solid #d8e3ef;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.07);
}

.sketch-toolbar__btn {
    padding: 6px 18px;
    border: 1px solid #c4d4e4;
    border-radius: 8px;
    background: #fff;
    color: #1a3a5c;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}

.sketch-toolbar__btn:hover {
    background: #eef4fb;
    border-color: #7aadd8;
}

.sketch-toolbar__btn.is-active {
    background: #1a3a5c;
    color: #fff;
    border-color: #1a3a5c;
}

/* ── Bottom menu (removed — content moved to sketch toolbar modals) ────────── */

.bottom-menu,
.bottom-menu.open,
.menu-content,
.bottom-menu.open .menu-content {
    display: none !important;
}

.toggle-menu-button {
    display: none; /* hidden — replaced by #sketchToolbar */
}

.toggle-menu-button.open {
    transform: rotate(180deg);
}

.menu-content {
    box-sizing: border-box;
    width: 100%;
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    pointer-events: auto;
    transform: translateY(calc(100% + 24px));
    transition: transform 0.3s ease-in-out;
    background-color: #f4f4f4;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 14px 18px 22px;
}

.bottom-menu.open .menu-content {
    transform: translateY(0);
}

.selections__container {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    flex-wrap: wrap;
    gap: 16px;
}

.selections__container.right {
    width: auto;
    text-align: left;
    justify-content: center;
}

.selections__feature2sketch-container {
    order: 1;
    flex: 1 1 620px;
    width: min(100%, 980px);
    margin-right: 0;
}

.selection-container {
    min-width: 0;
}

.selection-header,
.selection-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.1fr) minmax(120px, 0.8fr) minmax(72px, 0.45fr) minmax(180px, 1fr);
    gap: 10px;
    align-items: center;
}

.selection-row {
    padding: 5px 0;
}

.selection-row .column,
.selection-header .column {
    width: auto;
    min-width: 0;
}

.featureSelect {
    min-width: 0;
}

.range-slider-column {
    width: 100%;
}

.global-settings__container {
    order: 0;
    flex: 1 1 220px;
    min-width: min(100%, 220px);
    max-width: 360px;
    margin-right: 0;
}

.global-settings__content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.global-settings__item {
    min-width: 0;
    align-items: stretch;
}

.global-settings__item.global-data-settings {
    grid-column: 1 / -1;
}

.global-settings__label {
    box-sizing: border-box;
    width: 100%;
    min-height: 34px;
    line-height: 1.25;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.global-settings__label:hover {
    background: rgba(125, 210, 212, 0.18);
}

.global-settings__select {
    box-sizing: border-box;
    width: 100%;
    min-height: 30px;
    margin-top: 6px;
    border: 1px solid #c7c7c7;
    border-radius: 4px;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 0.9rem;
}

.objectifier-status {
    box-sizing: border-box;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d0d0d0;
    background: #fff;
    color: #424242;
    font-size: 0.86rem;
    line-height: 1.25;
}

.objectifier-status[data-state="available"] {
    border-color: #4f9d69;
    color: #1f6f45;
}

.objectifier-status[data-state="processing"] {
    border-color: #3f7fb5;
    color: #23527a;
}

.objectifier-status[data-state="missing"] {
    border-color: #d59a2f;
    color: #7a4d00;
}

.objectifier-status__line {
    display: flex;
    gap: 8px;
    align-items: baseline;
    justify-content: space-between;
}

.objectifier-status__percent {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.objectifier-status__bar {
    overflow: hidden;
    width: 100%;
    height: 6px;
    margin-top: 6px;
    border-radius: 999px;
    background: #e8edf3;
}

.objectifier-status__bar-fill {
    height: 100%;
    border-radius: inherit;
    background: #3f7fb5;
    transition: width 180ms ease;
}

.objectifier-ready-button {
    box-sizing: border-box;
    width: 100%;
    min-height: 34px;
    border: 1px solid #4f9d69;
    background: #edf8f1;
    color: #1f6f45;
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.objectifier-ready-button:hover {
    background: #dff2e8;
}

.global-settings__button {
    min-height: 38px;
}

.clap-contour-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c0c0c0;
    margin-left: 4px;
    vertical-align: middle;
    flex-shrink: 0;
    transition: background 0.3s ease;
}
.clap-contour-dot--loading {
    background: #f5a623;
    animation: clap-contour-pulse 1s ease-in-out infinite;
}
.clap-contour-dot--ready {
    background: #4f9d69;
}
@keyframes clap-contour-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (max-width: 980px) {
    .menu-content {
        padding: 12px;
    }

    .selections__feature2sketch-container,
    .global-settings__container {
        flex-basis: 100%;
        max-width: none;
    }

    .selection-header {
        display: none;
    }

    .selection-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 10px 0;
        border-bottom: 1px solid #ddd;
    }

    .selection-row .column {
        justify-content: stretch;
    }

    .characteristic-column,
    .checkbox-column {
        justify-content: flex-start !important;
    }
}

@media (max-width: 620px) {
    .bottom-menu {
        max-height: calc(100dvh - 56px);
    }

    .menu-content {
        max-height: calc(100dvh - 76px);
    }

    .global-settings__content {
        grid-template-columns: 1fr;
    }
}

.modal-content {
    user-select: none;
}

.modal-description {
    text-align: center;
}

.soundsketcher-stacked-slider {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.soundsketcher-compact-slider {
    width: 200px;
    margin-top: 10px;
}

.mixer-subcontainer {
    display: none;
}

.play-stop-button {
    display: none;
    background: none;
    border: none;
}

.play-stop-button__icon {
    width: 70px;
    height: 70px;
    cursor: pointer;
}

.clamp-feature-select {
    width: 100%;
    height: 238px;
}

.clamp-feature-note {
    margin-top: 12px;
    margin-right: 1em;
    margin-bottom: 0;
    color: #555;
    font-size: 0.9em;
}

.parameter-modal {
    width: 25%;
}

.parameter-row {
    gap: 20px;
}

.settings-label-start {
    align-self: flex-start;
}

.settings-label-center {
    align-self: center;
}

.settings-item-start {
    align-items: flex-start;
}

.wide-slider-column {
    width: 90%;
}

.section-divider {
    width: 90%;
    height: 1px;
    margin: 8.5px auto;
    border: 0;
    background-color: black;
}

/* ── Library panel header actions ─────────────────────────────────────── */

/* ── Semantic map overlay ──────────────────────────────────────────────── */
.semantic-map-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    background: rgba(10, 15, 25, 0.93);
    color: #e8edf5;
}

.semantic-map-overlay.app-hidden {
    display: none;
}

/* Retrieval panel reuses the semantic-map-overlay layout but needs to sit
   above the Library/Inspector side-panel rails (z-index 950), unlike the
   Sound Map whose content stays clear of the edges where the rails sit. */
#retrievalOverlay {
    z-index: 1000;
}

.semantic-map-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    flex-shrink: 0;
}

.semantic-map-overlay__titles {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.semantic-map-overlay__title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
}

.semantic-map-overlay__relabel-btn {
    padding: 0 10px;
    height: 26px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.18);
    background: transparent;
    color: #8a9bb5;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.semantic-map-overlay__relabel-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e8edf5;
}

.semantic-map-overlay__relabel-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.semantic-map-overlay__relabel-status {
    font-size: 11px;
    color: #6a9fb5;
    padding: 0 8px;
    white-space: nowrap;
}

.semantic-map-overlay__info-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: transparent;
    color: #8a9bb5;
    font-size: 12px;
    font-style: italic;
    font-family: Georgia, serif;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.semantic-map-overlay__info-btn:hover {
    background: rgba(255,255,255,0.10);
    color: #e8edf5;
}

.semantic-map-overlay__close {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    background: transparent;
    color: #e8edf5;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.semantic-map-overlay__close:hover {
    background: rgba(255,255,255,0.08);
}

.semantic-map-overlay__canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* SVG inside the map */
.semantic-map-overlay__canvas svg {
    width: 100%;
    height: 100%;
}

/* Map info panel */
.semantic-map-overlay__search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.semantic-map-overlay__search {
    width: 160px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    font: 600 12px/1.4 system-ui, sans-serif;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.semantic-map-overlay__search::placeholder {
    color: rgba(255,255,255,0.35);
}

.semantic-map-overlay__search:focus {
    border-color: rgba(72,176,154,0.7);
    background: rgba(255,255,255,0.12);
}

.semantic-map-overlay__search-count {
    font: 700 11px/1 system-ui, sans-serif;
    color: rgba(72,176,154,0.9);
    white-space: nowrap;
}

.semantic-map-overlay__files-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    font: 700 12px/1.4 system-ui, sans-serif;
    cursor: pointer;
    transition: background 0.15s;
}

.semantic-map-overlay__files-btn:hover {
    background: rgba(255,255,255,0.16);
}

.semantic-map-files-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 240px;
    max-height: 100%;
    overflow-y: auto;
    background: rgba(10, 15, 25, 0.97);
    border-left: 1px solid rgba(255,255,255,0.12);
    z-index: 10;
    padding: 20px 16px 28px;
    box-sizing: border-box;
    color: #c8d4e4;
}

.semantic-map-files-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.semantic-map-files-panel__heading {
    margin: 0;
    font: 700 13px/1 system-ui, sans-serif;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.semantic-map-files-panel__close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
}
.semantic-map-files-panel__close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.semantic-map-files-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.semantic-map-files-panel__item {
    margin: 0;
    padding: 0;
}

.semantic-map-files-panel__label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 6px;
    border-radius: 5px;
    transition: background 0.12s;
    font: 600 12px/1.3 system-ui, sans-serif;
    color: #c8d4e4;
}

.semantic-map-files-panel__label:hover {
    background: rgba(255,255,255,0.07);
}

.semantic-map-files-panel__check {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: #48b09a;
    cursor: pointer;
}

.semantic-map-files-panel__label span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.semantic-map-info-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    max-height: 100%;
    overflow-y: auto;
    background: rgba(10, 15, 25, 0.97);
    border-right: 1px solid rgba(255,255,255,0.12);
    z-index: 10;
    padding: 20px 20px 28px;
    box-sizing: border-box;
    color: #c8d4e4;
}

.semantic-map-info-panel__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: transparent;
    color: #8a9bb5;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.semantic-map-info-panel__close:hover {
    background: rgba(255,255,255,0.08);
    color: #e8edf5;
}

.semantic-map-info-panel__heading {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    color: #e8edf5;
    letter-spacing: 0.03em;
}

.semantic-map-info-panel__legend {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    row-gap: 10px;
}

.semantic-map-info-panel__legend dt {
    font-size: 11px;
    font-weight: 700;
    color: #a0b4cc;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.semantic-map-info-panel__legend dd {
    font-size: 12px;
    color: #8a9bb5;
    margin: 2px 0 0 0;
    line-height: 1.5;
}

/* Map tooltip */
.semantic-map-tooltip {
    position: fixed;
    z-index: 400;
    pointer-events: none;
    background: rgba(10, 15, 25, 0.92);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #e8edf5;
    max-width: 220px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.5);
}

.semantic-map-tooltip__filename {
    font-weight: 700;
    font-size: 11px;
    color: #a8bbd4;
    margin-bottom: 3px;
    word-break: break-all;
}

.semantic-map-tooltip__labels {
    font-size: 12px;
    line-height: 1.5;
}

.semantic-map-tooltip__stats {
    margin-top: 4px;
    font-size: 10px;
    color: #8a9bb5;
    letter-spacing: 0.02em;
}

@keyframes semantic-map-pulse {
    0%   { r: 0; stroke-opacity: 0.8; stroke-width: 2; }
    100% { r: 32px; stroke-opacity: 0; stroke-width: 0.5; }
}


.map-pulse-ring {
    stroke: rgba(255, 200, 80, 0.85);
    fill: none;
    animation: semantic-map-pulse 1.3s ease-out infinite;
    pointer-events: none;
}

.noise-threshold-container {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   Shared overlay utilities
   ═══════════════════════════════════════════════════════════════════════ */

/* Control row — rightmost group in overlay headers */
.overlay-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dark-themed select matching overlay headers */
.overlay-select {
    font-size: 12px;
    font-family: inherit;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    color: #c8d4e4;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.overlay-select:hover,
.overlay-select:focus {
    border-color: rgba(255,255,255,0.32);
    background: rgba(255,255,255,0.10);
}

/* Range wrap (label + input + value) */
.overlay-range-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #8a9bb5;
    white-space: nowrap;
    cursor: default;
}

.overlay-range {
    width: 64px;
    accent-color: #3a9a7e;
    cursor: pointer;
}

.overlay-range-val {
    min-width: 28px;
    font-size: 11px;
    color: #8a9bb5;
    font-variant-numeric: tabular-nums;
}

/* ── Find Moments overlay specifics ─────────────────────────────────────── */

/* Stacked header: multiple rows instead of single flex row */
.overlay-header--stacked {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.overlay-header__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.overlay-spacer {
    flex: 1;
}

/* Text inputs for prompts */
.overlay-input {
    font-size: 12px;
    font-family: inherit;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.07);
    color: #c8d4e4;
    min-width: 180px;
    flex: 1;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.overlay-input::placeholder {
    color: rgba(200,212,228,0.38);
}

.overlay-input:focus {
    border-color: rgba(74,143,168,0.7);
    background: rgba(255,255,255,0.10);
}

/* Text mode panel */
.retrieval-text-panel {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Search button — slightly more prominent */
.retrieval-search-btn {
    background: rgba(74,143,168,0.2);
    border-color: rgba(74,143,168,0.45);
    color: #a0d4e8;
}

.retrieval-search-btn:hover {
    background: rgba(74,143,168,0.38) !important;
    border-color: rgba(74,143,168,0.7) !important;
    color: #e0f4ff !important;
}

/* Audio mode example groups */
.retrieval-audio-group {
    margin-bottom: 8px;
}

.retrieval-audio-label {
    font-size: 11px;
    color: rgba(200,212,228,0.50);
    margin-bottom: 4px;
}

.retrieval-audio-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.retrieval-upload-label {
    cursor: pointer;
    margin: 0;
}

.retrieval-audio-list {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    font-size: 11px;
    max-height: 80px;
    overflow-y: auto;
}

/* Muted secondary button for negative contrast toggle */
.retrieval-neg-toggle {
    font-size: 11px;
    opacity: 0.60;
}

.retrieval-neg-toggle:hover {
    opacity: 1;
}

.retrieval-neg-panel {
    margin-top: 6px;
}

/* Results list */
.retrieval-results {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
    list-style: none;
    margin: 0;
}

/* Pick-mode banner */
.retrieval-pick-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(40,100,210,0.95);
    color: #fff;
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.retrieval-pick-banner.app-hidden {
    display: none;
}

/* Side panels shift down when mixer strip is open */
body.mixer-strip-open .side-panel {
    top: 158px;
}

/* ── Mixer strip (collapsible, fixed below navbar) ──────────────────────── */

.mixer-strip {
    position: fixed;
    top: 106px;
    left: 0;
    right: 0;
    z-index: 960;
    background: #f0f4fb;
    border-bottom: 1px solid #dce6f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10);
}

.mixer-strip__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    overflow-x: auto;
}

.mixer-strip__faders {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

.mixer-strip__play {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #b0c0d4;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s, border-color 0.12s;
}

.mixer-strip__play:hover {
    background: #ddeaf8;
    border-color: #7aaad0;
}

.mixer-strip__play .play-stop-button__icon {
    width: 16px;
    height: 16px;
}
