/* DJGABO Studio Audio LAB — original single-track editor, mobile presentation. */
@media (max-width:767px) {
  .dj-mobile-editor-shell {
    --dj-editor-reserved:278px;
    position:fixed;inset:0;z-index:2147482000;
    width:100%;max-width:100%;height:100vh;height:100dvh;
    overflow-x:clip;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;
    background:hsl(var(--background,250 34% 7%));
    color:hsl(var(--foreground,0 0% 96%));
    font-family:Inter,ui-sans-serif,system-ui,sans-serif;
    -webkit-overflow-scrolling:touch;
  }
  .dj-mobile-editor-shell::-webkit-scrollbar{display:none}
  html:has(body.dj-mobile-edit-open),body.dj-mobile-edit-open{overflow:hidden!important}
  .dj-mobile-editor-shell,.dj-mobile-editor-shell *{box-sizing:border-box;min-width:0}
  .dj-mobile-editor-shell button{font-family:inherit;color:inherit;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
  .dj-mobile-brand {
    position:sticky;top:0;z-index:3;display:flex;align-items:center;gap:8px;
    min-height:64px;padding:6px 8px;padding-top:calc(6px + env(safe-area-inset-top,0px));
    background:hsl(var(--background,250 34% 7%));
  }
  .dj-mobile-logo{flex:none;width:30px;height:34px;display:grid;place-items:center;border-radius:10px;background:linear-gradient(135deg,#a457ea,#32c6f4);color:white}
  .dj-mobile-logo svg{width:22px;height:22px}
  .dj-mobile-heading{flex:1;display:flex;flex-direction:column;gap:2px;line-height:1.2;overflow:hidden}
  .dj-mobile-product{color:hsl(var(--primary,263 85% 66%));font-weight:700;font-size:10px;letter-spacing:.07em}
  .dj-mobile-stem-name{font-size:14px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .dj-mobile-song{font-size:10px;color:hsl(var(--muted-foreground,250 15% 65%));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .dj-mobile-editor-body{width:100%;padding:4px 8px calc(8px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:6px}
  .dj-mobile-ruler{flex:none;height:22px;position:relative;pointer-events:none;color:hsl(var(--muted-foreground,250 15% 65%));font-size:10px;font-variant-numeric:tabular-nums}
  .dj-mobile-time-tick{position:absolute;top:0;bottom:0;transform:translateX(-50%);white-space:nowrap;line-height:16px}
  .dj-mobile-time-tick:after{content:"";position:absolute;bottom:0;left:50%;height:5px;width:1px;background:#82729c66}
  .dj-mobile-time-tick.dj-tick-first{transform:none}.dj-mobile-time-tick.dj-tick-last{transform:translateX(-100%)}
  .dj-mobile-wave-placeholder {
    position:relative;flex:none;width:100%;height:calc(65vh - 42px);
    height:min(calc(65dvh - 42px),calc(100dvh - var(--dj-editor-reserved) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));
    min-height:156px;border-radius:10px;background:#0d0c19;
  }
  .dj-mobile-view-labels{display:none}
  .dj-mobile-minimap{flex:none;position:relative;height:32px;width:100%;border:1px solid #514063;border-radius:7px;background:#121122;overflow:hidden;touch-action:none;cursor:pointer}
  .dj-mobile-minimap canvas{display:block;width:100%;height:100%;max-width:100%}
  .dj-mobile-map-window{position:absolute;top:1px;bottom:1px;border:1px solid #c17cfb;background:#a34ced22;border-radius:3px;pointer-events:none}
  .dj-mobile-region-status{display:grid;grid-template-columns:1fr 1fr 1fr;flex:none;min-height:42px;align-items:center;text-align:center;font-variant-numeric:tabular-nums}
  .dj-mobile-region-status>div{display:flex;flex-direction:column;gap:3px}
  .dj-mobile-region-status small{color:hsl(var(--muted-foreground));font-size:9px;font-weight:600;letter-spacing:.045em}
  .dj-mobile-region-status strong{font-size:13px;font-weight:600;white-space:nowrap}
  .dj-mobile-selection-length strong{color:#bd8cf8}
  .dj-mobile-playbar{flex:none;display:grid;grid-template-columns:repeat(5,1fr);align-items:center;justify-items:center;width:100%;height:52px;gap:8px}
  .dj-mobile-icon-btn{display:grid!important;place-items:center!important;flex:none;width:44px!important;min-width:44px!important;height:44px!important;padding:0!important;border:1px solid hsl(var(--border))!important;border-radius:12px!important;background:hsl(var(--secondary)/.45)!important;box-shadow:none!important}
  .dj-mobile-icon-btn svg{height:19px;width:19px}
  .dj-mobile-back.dj-mobile-icon-btn{border:0!important;background:transparent!important;border-radius:10px!important}
  .dj-mobile-playbar .dj-mobile-icon-btn:nth-child(3){width:50px!important;height:50px!important;border-radius:50%!important;background:hsl(var(--primary))!important;border-color:hsl(var(--primary))!important;color:#fff!important}
  .dj-mobile-icon-btn:active{transform:scale(.97)}
  .dj-mobile-icon-btn:focus-visible{outline:2px solid #bd8cf8;outline-offset:2px}
  .dj-mobile-meta{display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:20px;font-size:9px;color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums}
  .dj-mobile-pos{font-size:10px;white-space:nowrap;color:#d3c3e9}
  .dj-mobile-zoomlabel,.dj-mobile-saved{font-size:9px;white-space:nowrap}
  .dj-mobile-saved{color:#65ccb7}
  .dj-mobile-help{font-size:10px;line-height:1.25;text-align:center;color:hsl(var(--muted-foreground));min-height:13px}
  .dj-mobile-loading{font-size:11px;text-align:center;line-height:20px;color:hsl(var(--primary));margin:0}
  .dj-mobile-loading[hidden]{display:none!important}
  .dj-mobile-icon-btn[aria-busy="true"] svg{animation:dj-mobile-loading-spin 1s linear infinite}
  @keyframes dj-mobile-loading-spin{to{transform:rotate(360deg)}}
  body.dj-mobile-edit-open #root{position:relative;z-index:2147482150;visibility:hidden}
  body.dj-mobile-edit-open #root *{visibility:hidden!important}
  body.dj-mobile-edit-open #djgabo-mobile-daw-menu{visibility:hidden!important}
  body.dj-mobile-edit-open #root .dj-mobile-lifted-wave,
  body.dj-mobile-edit-open #root .dj-mobile-lifted-wave *{visibility:visible!important}
  body.dj-mobile-edit-open .daw-track-waveform-area [role="slider"].dj-mobile-lifted-wave {
    position:fixed!important;left:var(--dj-wave-left)!important;top:var(--dj-wave-top)!important;
    width:var(--dj-wave-width)!important;height:var(--dj-wave-height)!important;max-width:none!important;
    margin:0!important;z-index:2147482200!important;border:0!important;border-radius:10px!important;
    touch-action:none!important;outline:0!important;
    background-color:#0d0c19!important;
    background-image:linear-gradient(90deg,#8b79a41c 1px,transparent 1px)!important;
    background-size:var(--dj-grid-gap,100px) 100%!important;
    background-position-x:var(--dj-grid-offset,0px)!important;
    clip-path:inset(var(--dj-wave-clip-top,0px) 0 var(--dj-wave-clip-bottom,0px) 0);
  }
  body.dj-mobile-edit-open .dj-mobile-lifted-wave canvas {
    width:100%!important;height:100%!important;
  }
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-index]{background:#9b62e52b!important;border-color:#b185e5ce!important;border-left-width:2px!important;border-right-width:2px!important}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave .dj-mobile-region-active{background:#9b62e53b!important;border-color:#c49af2!important}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-edge]{position:absolute!important;width:44px!important;height:44px!important;min-width:44px!important;z-index:22!important;display:grid!important;place-items:center!important;background:transparent!important;border:0!important;padding:0!important;cursor:ew-resize}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-edge="start"]{left:0!important;right:auto!important;top:4px!important;bottom:auto!important;transform:translateX(var(--dj-start-shift,-50%))!important}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-edge="end"]{right:0!important;left:auto!important;top:auto!important;bottom:4px!important;transform:translateX(var(--dj-end-shift,50%))!important}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave .dj-mobile-region-active [data-region-edge]{z-index:27!important}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-edge]:before{content:"";position:absolute;inset:0 8px;border:1px solid #d4aff9bd;border-radius:8px;background:#724997f0;box-shadow:0 1px 5px #08051066;pointer-events:none}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-edge]:after{content:"";position:absolute;width:12px;height:15px;background:repeating-linear-gradient(90deg,#eedcff 0 2px,transparent 2px 5px);pointer-events:none}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-index]>button[aria-label="Quitar silencio"],
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-index]>button[aria-label="Eliminar silencio"]{position:absolute!important;width:40px!important;height:40px!important;min-width:40px!important;left:calc(50% + var(--dj-trash-offset,0px))!important;right:auto!important;top:var(--dj-trash-y,50%)!important;bottom:auto!important;transform:translate(-50%,-50%)!important;z-index:24!important;border:1px solid #bda6d738!important;border-radius:11px!important;background:#14101de8!important;color:#d6b5f5!important;display:grid!important;place-items:center!important;padding:0!important}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-index]>button[aria-label="Quitar silencio"] svg,
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-index]>button[aria-label="Eliminar silencio"] svg{width:17px!important;height:17px!important;pointer-events:none}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave [data-region-index]>span{top:56px!important;bottom:auto!important;left:50%!important;transform:translateX(-50%)!important;background:transparent!important;color:#c9a6ed!important;font-size:9px!important;padding:0!important;white-space:nowrap}
  body.dj-mobile-edit-open .dj-mobile-lifted-wave .dj-mobile-region-narrow>span{display:none!important}
  body.dj-mobile-edit-open #root .dj-mobile-lifted-wave .dj-mobile-trash-context>button[aria-label="Quitar silencio"]{visibility:hidden!important;pointer-events:none!important}
  .dj-mobile-playhead{position:absolute;top:0;bottom:0;width:2px;pointer-events:none;display:none}
  @media(max-height:620px){
    .dj-mobile-editor-shell{--dj-editor-reserved:242px}
    .dj-mobile-brand{min-height:56px;padding-top:calc(3px + env(safe-area-inset-top,0px));padding-bottom:3px}
    .dj-mobile-editor-body{gap:4px}
    .dj-mobile-ruler{height:20px}
    .dj-mobile-minimap{height:26px}
    .dj-mobile-region-status{min-height:36px}
    .dj-mobile-meta{min-height:18px}
  }
  @media(max-height:430px) and (orientation:landscape){
    .dj-mobile-editor-shell{--dj-editor-reserved:210px}
    .dj-mobile-brand{min-height:48px}.dj-mobile-song{display:none}
    .dj-mobile-editor-body{gap:3px;padding-top:2px;padding-bottom:calc(4px + env(safe-area-inset-bottom,0px))}
    .dj-mobile-ruler{height:18px}.dj-mobile-minimap{height:22px}
    .dj-mobile-region-status{min-height:32px}.dj-mobile-playbar{height:50px}
    .dj-mobile-help{display:none}
  }
  @media(max-height:350px) and (orientation:landscape){
    .dj-mobile-brand{min-height:44px;padding-top:env(safe-area-inset-top,0px);padding-bottom:0}
    .dj-mobile-logo{width:28px;height:28px}
    .dj-mobile-editor-body{gap:1px;padding-top:0;padding-bottom:calc(2px + env(safe-area-inset-bottom,0px))}
    .dj-mobile-ruler{height:16px}.dj-mobile-wave-placeholder{min-height:152px}
    .dj-mobile-minimap{height:18px}.dj-mobile-region-status{min-height:28px;line-height:1.1}
    .dj-mobile-region-status>div{gap:1px}.dj-mobile-region-status small{font-size:8px}.dj-mobile-region-status strong{font-size:12px}
    .dj-mobile-playbar{height:44px}.dj-mobile-playbar .dj-mobile-icon-btn:nth-child(3){width:44px!important;height:44px!important}
    .dj-mobile-meta{min-height:10px}.dj-mobile-meta,.dj-mobile-meta>*{font-size:9px;line-height:10px}
  }
  @media(prefers-reduced-motion:reduce){.dj-mobile-icon-btn[aria-busy="true"] svg{animation:none}}
}

/* Exactly the third M / S / expand slot, mobile only.
   No markup or layout changes to desktop and no overlays on waveforms. */
.dj-mobile-expand-wave{display:none!important}
@media (max-width:767px) {
  .daw-uvr-controls .dj-mobile-expand-wave {
    display:grid!important;
    box-sizing:border-box;
    place-items:center;
    position:relative;
    z-index:1;
    width:24px; height:24px; min-width:24px; min-height:24px;
    padding:0;
    margin:0;
    border-radius:4px;
    border:1px solid hsl(var(--border));
    background:hsl(var(--secondary) / .60);
    color:hsl(var(--muted-foreground));
    cursor:pointer;
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
  }
  .daw-uvr-controls .dj-mobile-expand-wave svg {
    width:13px;height:13px;stroke-width:1.9;pointer-events:none;
  }
  .daw-uvr-controls .dj-mobile-expand-wave::before {
    inset:0;
    pointer-events:none;
  }
  .daw-uvr-controls .dj-mobile-expand-wave:focus-visible {
    outline:2px solid hsl(var(--primary));outline-offset:1px;
  }
  .daw-uvr-controls .dj-mobile-expand-wave:active {
    transform:scale(.96);
  }
}

@media (max-width:767px) {
  /* Actual React Studio DAW toolbar: Lyrics + admin view + share + restore.
     The parent is identified by its native Lyrics accessible label; do not
     affect other admin navigation, track controls or DAW playback buttons. */
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]) {
    display:flex;
    flex-wrap:wrap !important;
    align-items:flex-start !important;
    justify-content:flex-start !important;
    column-gap:8px !important;
    row-gap:8px !important;
    min-width:0;
    max-width:100%;
    height:auto;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]) > div {
    display:flex;
    flex:1 1 100% !important;
    align-items:center;
    flex-wrap:wrap !important;
    gap:6px !important;
    width:100%;
    min-width:0;
    max-width:100%;
    margin-left:0 !important;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]) > div > button {
    max-width:100%;
    flex:0 1 auto;
    white-space:normal;
    line-height:1.2;
    min-height:32px;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]) > div > [aria-label="Vista del proyecto"] {
    flex:0 1 auto;
    min-width:0;
    max-width:100%;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]) > div > [aria-label="Vista del proyecto"] button {
    white-space:normal;
    min-width:0;
  }
}
/* Safety: never show the third M/S/expand button on desktop. */
@media (min-width:768px) {
  .dj-mobile-expand-wave { display:none!important; }
}

/* LAB8844 VISITOR-ONLY MOBILE TOOLBAR: 3 pills in one line; admin untouched. */
@media (max-width:767px) {
  /* Admin contains "Vista del proyecto" and preserves its existing two rows.
     Only the normal visitor toolbar (Lyrics / Share / Restore) is adjusted. */
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]):not(:has([aria-label="Vista del proyecto"])) {
    flex-wrap:nowrap !important;
    align-items:center !important;
    column-gap:clamp(3px,1vw,7px) !important;
    row-gap:0 !important;
    min-width:0;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]):not(:has([aria-label="Vista del proyecto"])) > div {
    width:auto !important;
    flex:0 0 auto !important;
    flex-wrap:nowrap !important;
    align-items:center;
    gap:clamp(3px,1vw,6px) !important;
    min-width:0;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]):not(:has([aria-label="Vista del proyecto"])) > div:last-child {
    flex:1 1 auto !important;
    justify-content:flex-end;
  }
  .mb-2.flex.min-h-8.w-full:has(> div > button[aria-label="Abrir Lyrics · Letras sincronizadas"]):not(:has([aria-label="Vista del proyecto"])) > div > button {
    flex:0 1 auto !important;
    min-width:0;
    max-width:100%;
    white-space:nowrap !important;
    min-height:32px;
    padding-left:clamp(4px,1.5vw,10px) !important;
    padding-right:clamp(4px,1.5vw,10px) !important;
    font-size:clamp(9px,2.7vw,11px) !important;
  }
}
