:root {
    --et-bottom-nav-height: 56px;
    --et-mini-player-height: 52px;
    --et-mobile-gap: 10px;
    --et-mobile-page-padding: 8px;
    --et-mobile-control-height: 40px;
    --et-mobile-field-min-width: 80px;
    --et-mobile-effect-slider-basis: 96px;
    --et-mobile-effect-slider-min-width: 80px;
    --et-mobile-player-primary-button-size: 72px;
}

html.layout-mobile {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-x: clip;
    box-sizing: border-box;
}

body.layout-mobile {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    display: block;
    margin: 0;
    padding: 0;
    padding-bottom: calc(var(--et-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
    overflow-x: hidden;
    overflow-x: clip;
    box-sizing: border-box;
}

body.layout-mobile .title-container {
    margin-top: calc(env(safe-area-inset-top) + var(--et-mobile-page-padding));
    margin-bottom: 8px;
    min-height: 40px;
}

body.layout-mobile .title-container,
body.layout-mobile .main-container,
body.layout-mobile .mobile-player-view {
    width: auto;
    max-width: none;
    min-width: 0;
    margin-inline: var(--et-mobile-page-padding);
    box-sizing: border-box;
}

/* Give the pipeline area the full viewport width; its children carry their
   own padding, so the page-level side margin is wasted space here. */
body.layout-mobile .main-container {
    margin-inline: 0;
}

body.layout-mobile .pipeline,
body.layout-mobile #pipelineList,
body.layout-mobile .pipeline-column,
body.layout-mobile .pipeline-item,
body.layout-mobile .plugin-ui,
body.layout-mobile .plugin-parameter-ui,
body.layout-mobile .plugin-parameter-ui > *,
body.layout-mobile .plugin-list-header,
body.layout-mobile .plugin-list-content,
body.layout-mobile .right-column-content,
body.layout-mobile .plugin-category-items,
body.layout-mobile .parameter-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

body.layout-mobile .plugin-ui,
body.layout-mobile .plugin-parameter-ui {
    overflow-x: hidden;
    overflow-x: clip;
}

body.layout-mobile h1 {
    font-size: 20px;
    line-height: 32px;
    /* Reserve room for the overflow header button. */
    padding-right: 48px;
}

body.layout-mobile .subtitle,
body.layout-mobile .whats-this,
body.layout-mobile .sidebar-button,
body.layout-mobile .plugin-list-pull-tab,
body.layout-mobile .column-control-button {
    display: none !important;
}

/* Mobile actions live in the overflow menu; the desktop settings gear and other
   desktop header controls are not shown in this layout. */
body.layout-mobile .header-buttons {
    display: none !important;
}

body.layout-mobile .header-buttons .header-button {
    width: var(--et-mobile-control-height);
    height: var(--et-mobile-control-height);
    min-width: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Mobile has its own Open Music and view navigation controls. */
body.layout-mobile .header-buttons .open-music-button,
body.layout-mobile .header-buttons .effect-pipeline-button,
body.layout-mobile .header-buttons .open-library-button {
    display: none !important;
}

body.layout-mobile .subtitle-container {
    margin-top: 4px;
}

/* Status/copy/paste messages are shown as a toast overlay so the header
   height never changes and the layout below does not shift. Messages are
   cleared by the existing clearError() timers, which dismisses the toast. */
body.layout-mobile .message-display {
    display: none;
}

body.layout-mobile .message-display:not(:empty) {
    display: block;
    position: fixed;
    left: 50%;
    bottom: calc(var(--et-bottom-nav-height) + var(--et-mini-player-height) + env(safe-area-inset-bottom) + 12px);
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    margin-left: 0;
    padding: 10px 16px;
    background-color: rgba(45, 45, 45, 0.95);
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1400;
    pointer-events: none;
}

body.layout-mobile .mobile-menu-button {
    position: absolute;
    right: 0;
    top: 0;
    width: var(--et-mobile-control-height);
    height: var(--et-mobile-control-height);
}

body.layout-mobile .mobile-menu-button,
body.layout-mobile .mobile-mini-button,
body.layout-mobile .mobile-mini-open-music,
body.layout-mobile .mobile-plugin-list-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #5d5d5d;
    border-radius: 4px;
    background: #4d4d4d;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body.layout-mobile .mobile-menu-button,
body.layout-mobile .mobile-plugin-list-close {
    color: #4a9eff;
}

body.layout-mobile .mobile-menu-button svg,
body.layout-mobile .mobile-mini-button svg,
body.layout-mobile .mobile-plugin-fab svg,
body.layout-mobile .mobile-plugin-list-close svg {
    display: block;
    flex: 0 0 auto;
}

body.layout-mobile .mobile-menu-button:focus-visible,
body.layout-mobile .mobile-mini-button:focus-visible,
body.layout-mobile .mobile-mini-open-music:focus-visible,
body.layout-mobile .mobile-plugin-fab:focus-visible,
body.layout-mobile .mobile-plugin-list-close:focus-visible,
body.layout-mobile .mobile-bottom-button:focus-visible {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

body.layout-mobile .mobile-menu-button:active,
body.layout-mobile .mobile-mini-button:active,
body.layout-mobile .mobile-mini-open-music:active,
body.layout-mobile .mobile-plugin-list-close:active,
body.layout-mobile .mobile-bottom-button:active {
    background: #6d6d6d;
}

body.layout-mobile .mobile-plugin-fab:active {
    background: #3d8ae0;
    transform: translateY(1px);
}

body.layout-mobile .mobile-menu-button:disabled,
body.layout-mobile .mobile-mini-button:disabled,
body.layout-mobile .mobile-mini-open-music:disabled,
body.layout-mobile .mobile-plugin-fab:disabled,
body.layout-mobile .mobile-plugin-list-close:disabled,
body.layout-mobile .mobile-bottom-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (hover: hover) {
    body.layout-mobile .mobile-menu-button:hover:not(:disabled),
    body.layout-mobile .mobile-mini-button:hover:not(:disabled),
    body.layout-mobile .mobile-mini-open-music:hover:not(:disabled),
    body.layout-mobile .mobile-plugin-list-close:hover:not(:disabled),
    body.layout-mobile .mobile-bottom-button:hover:not(:disabled) {
        background: #5d5d5d;
    }

    body.layout-mobile .mobile-plugin-fab:hover:not(:disabled) {
        background: #3d8ae0;
        border-color: #7abaff;
    }

    body.layout-mobile .mobile-bottom-button.active:hover {
        background: #4d4d4d;
    }
}

body.layout-mobile .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1190;
    background: rgba(0, 0, 0, 0.35);
}

body.layout-mobile .mobile-menu-backdrop.mobile-open {
    display: block;
}

body.layout-mobile .mobile-overflow-menu {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    right: 8px;
    display: none;
    min-width: 190px;
    padding: 6px;
    border: 1px solid #4d4d4d;
    border-radius: 6px;
    background: #2d2d2d;
    z-index: 1200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

body.layout-mobile .mobile-overflow-menu.mobile-open {
    display: block;
}

body.layout-mobile .mobile-overflow-menu-item {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #fff;
    text-align: left;
    font-size: 16px;
}

body.layout-mobile .main-container {
    display: block;
    min-height: 0;
    overflow-x: hidden;
    overflow-x: clip;
}

body.layout-mobile .file-drop-area {
    display: none !important;
}

body.layout-mobile .file-drop-area.file-processing-active {
    display: block !important;
    padding: 12px;
    margin: 12px 0 0;
    border-style: solid;
}

body.layout-mobile .file-drop-area .drop-message {
    display: none !important;
}

body.layout-mobile.view-player .main-container,
body.layout-mobile.view-player .mobile-mini-player,
body.layout-mobile.view-player .mobile-plugin-fab {
    display: none;
}

body.layout-mobile.view-effects .mobile-player-view {
    display: none;
}

body.layout-mobile.view-player .double-blind-test,
body.layout-mobile.view-effects .double-blind-test {
    display: block;
}

body.layout-mobile.view-effects {
    padding-bottom: calc(var(--et-bottom-nav-height) + var(--et-mini-player-height) + env(safe-area-inset-bottom) + 8px);
}

/* Lay the Player tab out as a flex column so the player fills the space left
   over by the title and the version/copyright footer. A fixed viewport-based
   min-height cannot know those heights and always overflowed by their sum,
   forcing a scroll even when everything fit. Flex-grow sizes the player to the
   exact remaining space, so the page only scrolls when content truly overflows. */
body.layout-mobile.view-player {
    display: flex;
    flex-direction: column;
    height: 100svh;
    overflow-y: hidden;
}

body.layout-mobile .mobile-player-view {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

body.layout-mobile .mobile-player-empty {
    flex: 1 1 auto;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 16px;
}

body.layout-mobile .mobile-player-empty-title {
    color: #ccc;
    font-size: 18px;
}

body.layout-mobile .mobile-open-music {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 132px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid #5d5d5d;
    border-radius: 4px;
    background-color: #4d4d4d;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

body.layout-mobile .mobile-open-music:active {
    background-color: #6d6d6d;
}

body.layout-mobile .mobile-audio-resume-prompt {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(var(--et-bottom-nav-height) + env(safe-area-inset-bottom) + 16px);
    z-index: 1205;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

body.layout-mobile .mobile-audio-resume-prompt[hidden] {
    display: none;
}

body.layout-mobile .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    width: auto;
    max-width: none;
    height: calc(var(--et-bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: hidden;
    overflow-x: clip;
    background: #2d2d2d;
    border-top: 1px solid #3d3d3d;
    box-sizing: border-box;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.25);
}

body.layout-mobile .mobile-bottom-button {
    flex: 1 1 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 48px;
    border: 0;
    border-right: 1px solid #3d3d3d;
    background: #2d2d2d;
    color: #ddd;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

body.layout-mobile .mobile-bottom-button:last-child {
    border-right: 0;
}

body.layout-mobile .mobile-bottom-button.active {
    color: #fff;
    background: #444;
    box-shadow: inset 0 2px 0 #4a9eff;
}

body.layout-mobile .mobile-bottom-button-icon,
body.layout-mobile .mobile-bottom-button-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

body.layout-mobile .mobile-bottom-button-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    line-height: 14px;
}

body.layout-mobile .mobile-mini-player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--et-bottom-nav-height) + env(safe-area-inset-bottom));
    z-index: 990;
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: none;
    height: var(--et-mini-player-height);
    padding: 6px 10px;
    overflow-x: hidden;
    overflow-x: clip;
    border-top: 1px solid #3d3d3d;
    background: #2d2d2d;
    box-sizing: border-box;
}

body.layout-mobile .mobile-mini-track {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 14px;
}

body.layout-mobile .mobile-mini-button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    color: #fff;
}

body.layout-mobile .mobile-mini-open-music {
    flex: 0 0 auto;
    min-width: 112px;
    height: 40px;
    padding: 0 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

body.layout-mobile .mobile-mini-button[hidden],
body.layout-mobile .mobile-mini-open-music[hidden] {
    display: none;
}

body.layout-mobile .mobile-plugin-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--et-bottom-nav-height) + var(--et-mini-player-height) + env(safe-area-inset-bottom) + 16px);
    z-index: 980;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #66b0ff;
    border-radius: 50%;
    background: #4a9eff;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.08s ease;
}

body.layout-mobile .plugin-list {
    position: fixed;
    inset: 0;
    display: none;
    width: auto;
    max-width: none;
    min-width: 0;
    max-height: none;
    padding: calc(60px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
    border-radius: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overflow-x: clip;
    z-index: 1100;
    transform: none;
    box-sizing: border-box;
    scrollbar-width: none;
}

body.layout-mobile .plugin-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

body.layout-mobile .plugin-list.mobile-open {
    display: block;
}

body.layout-mobile .mobile-plugin-list-close {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
    z-index: 1110;
    width: 40px;
    height: 40px;
    color: #ff6b6b;
}

body.layout-mobile .plugin-list-header,
body.layout-mobile .plugin-list-content {
    width: auto;
}

body.layout-mobile .plugin-list-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    grid-template-rows: 40px;
    align-items: center;
    gap: 8px;
    position: relative;
    height: auto;
    min-height: 54px;
    width: 100%;
    padding: 0 0 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid #3d3d3d;
    box-sizing: border-box;
}

body.layout-mobile .plugin-list-header h2 {
    display: none !important;
}

body.layout-mobile .tab-switcher {
    position: static;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
}

body.layout-mobile .tab-button {
    justify-content: center;
    min-width: 0;
    min-height: var(--et-mobile-control-height);
    height: var(--et-mobile-control-height);
    box-sizing: border-box;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

body.layout-mobile .effect-search-input {
    position: static;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    height: 40px;
    margin: 0;
    padding: 0 36px 0 12px;
    font-size: 16px;
}

body.layout-mobile .search-button {
    position: static;
    grid-column: 2;
    grid-row: 1;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    margin: 0;
}

body.layout-mobile .effect-search-clear-button {
    top: 11px;
    right: 48px;
}

body.layout-mobile .effect-search-clear-button.visible {
    display: flex;
}

body.layout-mobile .plugin-list-content {
    width: 100%;
    gap: 8px;
}

body.layout-mobile .category-row {
    display: block;
}

body.layout-mobile .plugin-list-content h3,
body.layout-mobile .category-effects-count {
    margin-top: 10px;
    margin-bottom: 8px;
}

body.layout-mobile .plugin-category-items {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 150px));
    justify-content: start;
    gap: 8px;
}

body.layout-mobile .plugin-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 9px 12px;
    margin: 0;
    line-height: 1.25;
    cursor: pointer;
    box-sizing: border-box;
}

body.layout-mobile .plugin-description {
    display: none !important;
}

body.layout-mobile .pipeline-empty,
body.layout-mobile #pipelineList.is-empty #pipelineEmpty {
    pointer-events: auto;
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 32px 16px;
}

body.layout-mobile .pipeline-empty-message {
    pointer-events: none;
    color: #888;
    line-height: 1.4;
}

body.layout-mobile .pipeline {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-x: clip;
}

body.layout-mobile .pipeline-header {
    flex-wrap: wrap;
    gap: 8px;
}

/* Share the row with the master toggle / A-B controls when everything fits;
   margin-left: auto keeps the undo-and-later group right-aligned both on the
   shared row and after wrapping onto its own row. */
body.layout-mobile .pipeline-header-right {
    flex: 0 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
}

body.layout-mobile .select-container {
    flex: 1 1 180px;
    width: auto;
    min-width: 0;
}

body.layout-mobile .preset-select {
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    min-width: var(--et-mobile-field-min-width);
    padding-right: 64px;
    box-sizing: border-box;
}

body.layout-mobile .preset-dropdown-button {
    width: var(--et-mobile-control-height);
    height: calc(var(--et-mobile-control-height) - 2px);
}

body.layout-mobile .preset-clear-button {
    right: var(--et-mobile-control-height);
}

body.layout-mobile .preset-list-option {
    min-height: var(--et-mobile-control-height);
}

body.layout-mobile select {
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    min-width: var(--et-mobile-field-min-width);
    box-sizing: border-box;
}

body.layout-mobile input:not([type="radio"]):not([type="checkbox"]) {
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    min-width: var(--et-mobile-field-min-width);
    box-sizing: border-box;
}

body.layout-mobile .pipeline-preset-controls {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    width: max-content;
    max-width: 100%;
    min-width: 0;
}

body.layout-mobile .pipeline-preset-controls .select-container {
    flex: 1 1 180px;
    min-width: 0;
}

body.layout-mobile #pipelineList {
    display: block;
}

body.layout-mobile .pipeline-column {
    gap: 10px;
}

body.layout-mobile .pipeline-item {
    width: 100%;
    box-sizing: border-box;
    padding: 0;
}

body.layout-mobile .pipeline-item-header {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 10px 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 6px;
}

body.layout-mobile .header-button,
body.layout-mobile .save-button,
body.layout-mobile .delete-preset-button,
body.layout-mobile .help-button,
body.layout-mobile .ai-button,
body.layout-mobile .delete-button,
body.layout-mobile .move-up-button,
body.layout-mobile .move-down-button,
body.layout-mobile .routing-button,
body.layout-mobile .reset-effect-button,
body.layout-mobile .undo-button,
body.layout-mobile .redo-button,
body.layout-mobile .cut-button,
body.layout-mobile .copy-button,
body.layout-mobile .paste-button {
    min-width: 40px;
    min-height: 40px;
}

body.layout-mobile .toggle-button {
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    box-sizing: border-box;
}

body.layout-mobile .pipeline-item-header .handle {
    flex: 0 0 18px;
    width: 18px;
    min-width: 18px;
    min-height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

body.layout-mobile .pipeline-item-header .toggle-button {
    position: relative;
    z-index: 0;
    flex: 0 0 48px;
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    box-sizing: border-box;
    padding: 8px 0;
    border: 0;
    background-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

body.layout-mobile .pipeline-item-header .toggle-button::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border: 1px solid #606060;
    border-radius: 4px;
    background-color: #4CAF50;
    pointer-events: none;
    z-index: -1;
}

body.layout-mobile .pipeline-item-header .toggle-button.off::before {
    background-color: #808080;
}

body.layout-mobile .pipeline-item-header .plugin-name {
    flex: 1 1 120px;
    min-width: 96px;
    min-height: 40px;
    display: flex;
    align-items: center;
    line-height: 20px;
}

body.layout-mobile .plugin-header-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    width: max-content;
    max-width: 100%;
    justify-content: flex-end;
    margin-left: auto;
}

body.layout-mobile .plugin-header-actions > .help-button,
body.layout-mobile .plugin-header-actions > .ai-button,
body.layout-mobile .plugin-header-actions > .delete-button,
body.layout-mobile .plugin-header-actions > .move-up-button,
body.layout-mobile .plugin-header-actions > .move-down-button,
body.layout-mobile .plugin-header-actions > .routing-button,
body.layout-mobile .plugin-header-actions > .reset-effect-button {
    flex-basis: 40px;
    margin-right: 0;
}

body.layout-mobile .header-button.mobile-open-music {
    min-height: 44px;
    height: 44px;
}

body.layout-mobile .plugin-parameter-ui .parameter-row {
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

body.layout-mobile .plugin-parameter-ui input[type="range"] {
    min-width: var(--et-mobile-effect-slider-min-width);
}

body.layout-mobile .plugin-parameter-ui .parameter-row input[type="range"] {
    flex: 1 1 var(--et-mobile-effect-slider-basis);
    width: auto;
    min-width: var(--et-mobile-effect-slider-min-width);
    max-width: 100%;
}

body.layout-mobile .plugin-parameter-ui .parameter-row input[type="number"],
body.layout-mobile .plugin-parameter-ui .parameter-row input[type="text"],
body.layout-mobile .plugin-parameter-ui select,
body.layout-mobile .routing-dialog-row select,
body.layout-mobile .ai-dialog-textarea {
    min-height: var(--et-mobile-control-height);
    font-size: 16px;
}

body.layout-mobile .plugin-parameter-ui .parameter-row input[type="text"],
body.layout-mobile .plugin-parameter-ui .parameter-row > select {
    flex: 1 1 180px;
    width: auto;
    min-width: var(--et-mobile-field-min-width);
    max-width: 100%;
    box-sizing: border-box;
}

body.layout-mobile .plugin-parameter-ui label,
body.layout-mobile .parameter-row label {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
}

/* Mobile player uses an outer grid for major rows only; transport controls
   and the queue are laid out together inside .player-controls below. */
body.layout-mobile .audio-player {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
        "title"
        "artwork"
        "track"
        "controls";
    gap: 16px;
    align-items: stretch;
    min-height: 0;
    max-height: 100%;
    padding: 10px;
    margin: 0;
    align-content: start;
    overflow-y: auto;
}

body.layout-mobile .audio-player h2 {
    grid-area: title;
    margin: 0;
    text-align: center;
}

body.layout-mobile .player-artwork {
    grid-area: artwork;
    display: grid;
    place-items: center;
    width: min(68vw, 280px);
    height: min(68vw, 280px);
    margin: 0 auto;
    border-radius: 10px;
    background: #1d1d1d;
    color: #5d5d5d;
    overflow: hidden;
}

body.layout-mobile .player-artwork-image {
    border-radius: 8px;
}

body.layout-mobile .player-artwork-placeholder {
    display: grid;
    place-items: center;
}

body.layout-mobile .player-artwork-placeholder[hidden] {
    display: none;
}

body.layout-mobile .track-name-container {
    grid-area: track;
    display: block;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    overflow: hidden;
    margin: 0;
    text-align: center;
}

body.layout-mobile .track-name {
    display: block;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
    line-height: 1.35;
    font-size: 18px;
}

/* Keep this as a real grid box. Stretch grid items so the playlist stays
   inside its own row instead of centering upward over the play button. */
body.layout-mobile .player-controls {
    grid-area: controls;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows:
        var(--et-mobile-control-height)
        auto
        48px
        var(--et-mobile-player-primary-button-size)
        auto;
    grid-template-areas:
        "seek seek seek seek seek seek"
        "time time time time time time"
        "shuffle previous stop next repeat close"
        "play play play play play play"
        "playlist playlist playlist playlist playlist playlist";
    gap: 12px 8px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    box-sizing: border-box;
}

body.layout-mobile .player-controls > * {
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
}

body.layout-mobile .seek-bar {
    grid-area: seek;
    display: block;
    align-self: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

body.layout-mobile .time-display {
    grid-area: time;
    align-self: center;
    min-width: 0;
}

body.layout-mobile .player-button {
    align-self: center;
    width: 100%;
    height: 48px;
    min-width: 0;
    padding: 0;
}

body.layout-mobile .shuffle-button {
    grid-area: shuffle;
}

body.layout-mobile .prev-button {
    grid-area: previous;
}

body.layout-mobile .stop-button {
    grid-area: stop;
}

body.layout-mobile .next-button {
    grid-area: next;
}

body.layout-mobile .repeat-button {
    grid-area: repeat;
}

body.layout-mobile .close-button {
    grid-area: close;
}

/* The mobile player is always fully expanded, so the desktop expand toggle
   stays hidden and out of the control grid. */
body.layout-mobile .expand-button {
    display: none;
}

body.layout-mobile .double-blind-test .dbt-close-button,
body.layout-mobile .double-blind-test .dbt-testname-row .save-button,
body.layout-mobile .double-blind-test .dbt-testname-row .delete-preset-button {
    flex: 0 0 var(--et-mobile-control-height);
    width: var(--et-mobile-control-height);
    min-width: var(--et-mobile-control-height);
    max-width: var(--et-mobile-control-height);
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    max-height: var(--et-mobile-control-height);
    padding: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.layout-mobile .double-blind-test .dbt-close-button svg,
body.layout-mobile .double-blind-test .dbt-testname-row .save-button svg,
body.layout-mobile .double-blind-test .dbt-testname-row .delete-preset-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: block;
}

body.layout-mobile .play-pause-button {
    grid-area: play;
    justify-self: center;
    align-self: center;
    width: var(--et-mobile-player-primary-button-size);
    height: var(--et-mobile-player-primary-button-size);
    min-height: var(--et-mobile-player-primary-button-size);
    border-radius: 50%;
    color: #ffffff;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 38%), linear-gradient(180deg, #67b9ff, #3f8fe8);
    border-color: #8ccaff;
    box-shadow: 0 14px 32px rgba(74, 158, 255, 0.34), 0 6px 18px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

body.layout-mobile .play-pause-button svg {
    width: 24px;
    height: 24px;
}

body.layout-mobile .play-pause-button:active {
    transform: translateY(1px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 38%), linear-gradient(180deg, var(--et-accent), var(--et-accent-pressed));
    box-shadow: 0 10px 24px rgba(74, 158, 255, 0.28), 0 4px 14px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.layout-mobile .play-pause-button:disabled {
    transform: none;
}

@media (hover: hover) {
    body.layout-mobile .play-pause-button:hover:not(:disabled) {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 38%), linear-gradient(180deg, #77c2ff, var(--et-accent));
        border-color: #a4d7ff;
        box-shadow: 0 16px 36px rgba(74, 158, 255, 0.4), 0 8px 22px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    }
}

body.layout-mobile .player-playlist {
    grid-area: playlist;
    display: block;
    align-self: stretch;
    height: 100%;
    min-height: 220px;
    max-height: 28svh;
    overflow-y: auto;
    box-sizing: border-box;
}

body.layout-mobile .player-playlist-item {
    min-height: 44px;
    font-size: 14px;
}

body.layout-mobile .routing-dialog,
body.layout-mobile .ai-dialog {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 10px 10px 0 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    max-height: 70vh;
    overflow-y: auto;
    box-sizing: border-box;
    transform: none !important;
    z-index: 1200;
}

body.layout-mobile .routing-dialog-row {
    flex-wrap: wrap;
}

body.layout-mobile canvas,
body.layout-mobile svg {
    max-width: 100%;
}

body.layout-mobile .plugin-parameter-ui canvas {
    width: 100% !important;
    height: auto !important;
}

body.layout-mobile .graph-container,
body.layout-mobile [class$="-graph"],
body.layout-mobile [class*="-graph "] {
    width: 100% !important;
    max-width: 100% !important;
}

body.layout-mobile .graph-container canvas,
body.layout-mobile .graph-container svg {
    width: 100% !important;
    height: auto !important;
}

body.layout-mobile .responsive-graph-container {
    height: auto !important;
}

body.layout-mobile .responsive-graph-container[style*="--mobile-aspect-ratio"] {
    aspect-ratio: var(--mobile-aspect-ratio) !important;
}

body.layout-mobile .responsive-graph-container canvas {
    height: 100% !important;
}

body.layout-mobile .radio-group label,
body.layout-mobile .parameter-row input[type="checkbox"] + label,
body.layout-mobile .parameter-row label:has(+ input[type="checkbox"]),
body.layout-mobile label:has(> input[type="radio"]),
body.layout-mobile label:has(> input[type="checkbox"]) {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

/* Radio/checkbox widgets ignore padding, so vertical margins give every glyph
   a 40px-tall footprint (18px glyph + 11px * 2) matching the mobile control
   height, while the glyph itself stays at 18px. */
body.layout-mobile input[type="radio"],
body.layout-mobile input[type="checkbox"] {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin-top: 11px;
    margin-bottom: 11px;
}

body.layout-mobile .plugin-parameter-ui select {
    min-width: var(--et-mobile-field-min-width);
    max-width: 100%;
    box-sizing: border-box;
    text-overflow: ellipsis;
}

/* Injected app dialogs (audio config / settings): their styles come from
   <style> blocks in js/electron/audioIntegration.js and configIntegration.js,
   so the mobile sizing is unified here. */
body.layout-mobile .audio-config-dialog,
body.layout-mobile .config-dialog {
    width: min(400px, calc(100vw - 32px));
    max-height: calc(100svh - 32px);
    overflow-y: auto;
    box-sizing: border-box;
}

body.layout-mobile .checkbox-container,
body.layout-mobile .radio-container {
    min-height: var(--et-mobile-control-height);
    align-items: center;
}

body.layout-mobile .checkbox-container label,
body.layout-mobile .radio-container label {
    display: inline-flex;
    align-items: center;
    min-height: var(--et-mobile-control-height);
}

body.layout-mobile .dialog-buttons button {
    height: var(--et-mobile-control-height);
    min-height: var(--et-mobile-control-height);
    box-sizing: border-box;
}

@media (pointer: coarse) {
    .player-button,
    .header-button,
    .plugin-item,
    input,
    select,
    button {
        touch-action: manipulation;
    }
}

/* Mobile visual polish mirrors the desktop surface treatment. */
body.layout-mobile .message-display:not(:empty) {
    background: linear-gradient(180deg, rgba(55, 55, 55, 0.97), rgba(40, 40, 40, 0.97));
    border-color: #626262;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.layout-mobile .mobile-menu-button,
body.layout-mobile .mobile-mini-button,
body.layout-mobile .mobile-mini-open-music,
body.layout-mobile .mobile-plugin-list-close,
body.layout-mobile .mobile-open-music {
    background: var(--et-control-gradient);
    border-color: #5f5f5f;
    box-shadow: var(--et-control-shadow);
}

body.layout-mobile .mobile-menu-button:active,
body.layout-mobile .mobile-mini-button:active,
body.layout-mobile .mobile-mini-open-music:active,
body.layout-mobile .mobile-plugin-list-close:active,
body.layout-mobile .mobile-bottom-button:active,
body.layout-mobile .mobile-open-music:active {
    background: var(--et-control-active-gradient);
}

@media (hover: hover) {
    body.layout-mobile .mobile-menu-button:hover:not(:disabled),
    body.layout-mobile .mobile-mini-button:hover:not(:disabled),
    body.layout-mobile .mobile-mini-open-music:hover:not(:disabled),
    body.layout-mobile .mobile-plugin-list-close:hover:not(:disabled),
    body.layout-mobile .mobile-bottom-button:hover:not(:disabled),
    body.layout-mobile .mobile-open-music:hover:not(:disabled) {
        background: var(--et-control-hover-gradient);
        border-color: #6e6e6e;
        box-shadow: var(--et-control-hover-shadow);
    }
}

body.layout-mobile .mobile-menu-backdrop {
    background: rgba(0, 0, 0, 0.46);
}

body.layout-mobile .mobile-overflow-menu {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 34px), linear-gradient(145deg, #333333, #292929);
    border-color: #515151;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.layout-mobile .mobile-overflow-menu-item:hover,
body.layout-mobile .mobile-overflow-menu-item:active {
    background: linear-gradient(180deg, #3f3f3f, #363636);
}

body.layout-mobile .mobile-audio-resume-prompt {
    background: linear-gradient(180deg, rgba(44, 44, 44, 0.94), rgba(20, 20, 20, 0.94));
    border-color: rgba(255, 255, 255, 0.24);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.layout-mobile .mobile-bottom-nav {
    background: linear-gradient(180deg, #303030, #272727);
    border-top-color: #444444;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body.layout-mobile .mobile-bottom-button {
    background: linear-gradient(180deg, #303030, #282828);
    border-right-color: #3f3f3f;
}

body.layout-mobile .mobile-bottom-button.active {
    background: linear-gradient(180deg, #484848, #3b3b3b);
    box-shadow: inset 0 2px 0 var(--et-accent), inset 0 0 0 1px rgba(74, 158, 255, 0.12);
}

body.layout-mobile .mobile-mini-player {
    background: linear-gradient(180deg, #303030, #282828);
    border-top-color: #444444;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body.layout-mobile .mobile-plugin-fab {
    background: radial-gradient(circle at 32% 20%, rgba(255, 255, 255, 0.32), transparent 20px), linear-gradient(180deg, var(--et-accent-hover), var(--et-accent));
    border-color: #82c4ff;
    box-shadow: 0 12px 30px rgba(74, 158, 255, 0.34), 0 6px 18px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

body.layout-mobile .mobile-plugin-fab:active {
    background: radial-gradient(circle at 32% 20%, rgba(255, 255, 255, 0.24), transparent 20px), linear-gradient(180deg, var(--et-accent), var(--et-accent-pressed));
}

@media (hover: hover) {
    body.layout-mobile .mobile-plugin-fab:hover:not(:disabled) {
        background: radial-gradient(circle at 32% 20%, rgba(255, 255, 255, 0.36), transparent 20px), linear-gradient(180deg, #72bfff, var(--et-accent));
        border-color: #9bd0ff;
    }
}

body.layout-mobile .plugin-list-header {
    border-bottom-color: #444444;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025);
}

body.layout-mobile .pipeline-item-header .toggle-button::before {
    background: linear-gradient(180deg, #57bd5b, #439846);
    border-color: #67cc6a;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body.layout-mobile .pipeline-item-header .toggle-button.off::before {
    background: linear-gradient(180deg, #8a8a8a, #747474);
    border-color: #929292;
    box-shadow: var(--et-control-shadow);
}

body.layout-mobile .player-artwork {
    background: linear-gradient(145deg, #242424, #191919);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.055), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

body.layout-mobile input[type="range"]:not(.vertical-slider) {
    height: var(--et-mobile-control-height);
}

body.layout-mobile input[type="range"]:not(.vertical-slider)::-webkit-slider-runnable-track {
    height: 7px;
}

body.layout-mobile input[type="range"]:not(.vertical-slider)::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -7px;
}

body.layout-mobile input[type="range"]:not(.vertical-slider)::-moz-range-track {
    height: 7px;
}

body.layout-mobile input[type="range"]:not(.vertical-slider)::-moz-range-thumb {
    width: 20px;
    height: 20px;
}
