/* ============================================================================
   MIGHTY MEDIA STUDIO | STEM LAB | FULL-SHEET WORKSPACE
   Prototype presentation owner only. SCNet engine logic remains untouched.
   Geometry master: 1280px. Portrait owns only its stacked reflow.
   ============================================================================ */

.stem-lab-page{
  --stem-lab-u:.078125vw;
  --stem-lab-orange:#ff7300;
  width:100%;
  min-width:0;
  color:#f4f2ed;
}
.stem-lab-stage{width:100%;padding:calc(34 * var(--stem-lab-u)) calc(22 * var(--stem-lab-u)) calc(38 * var(--stem-lab-u));}
.stem-lab-layout{
  display:grid;
  grid-template-columns:minmax(0,.82fr) minmax(0,1.18fr);
  width:100%;
  max-width:calc(1236 * var(--stem-lab-u));
  min-height:calc(620 * var(--stem-lab-u));
  margin:0 auto;
  overflow:hidden;
  border:0;
  border-radius:calc(10 * var(--stem-lab-u));
  background:#13151a;
}
.stem-lab-info,.stem-lab-console{min-width:0;padding:calc(42 * var(--stem-lab-u));}
.stem-lab-info{display:flex;flex-direction:column;background:#13151a;}
.stem-lab-console{display:flex;align-items:stretch;justify-content:stretch;background:#17191e;padding:calc(20 * var(--stem-lab-u));}
.stem-lab-kicker{display:flex;align-items:center;gap:calc(12 * var(--stem-lab-u));margin-bottom:calc(14 * var(--stem-lab-u));color:#b5b8bf;font-size:calc(17 * var(--stem-lab-u));font-weight:500;letter-spacing:.12em;line-height:1.2;}
.stem-lab-kicker>span{display:block;flex:0 0 calc(26 * var(--stem-lab-u));width:calc(26 * var(--stem-lab-u));height:calc(3 * var(--stem-lab-u));background:var(--stem-lab-orange);}
.stem-lab-info h1{margin:0 0 calc(30 * var(--stem-lab-u));font-size:calc(50 * var(--stem-lab-u));font-weight:500;line-height:1.03;letter-spacing:-.02em;color:#f4f2ed;}
.stem-lab-info h1 span{color:var(--stem-lab-orange);}
.stem-lab-benefits{display:grid;gap:calc(20 * var(--stem-lab-u));margin:0;padding:0;list-style:none;}
.stem-lab-benefits li{position:relative;margin:0;padding-left:calc(25 * var(--stem-lab-u));color:#aeb2ba;font-size:calc(16 * var(--stem-lab-u));font-weight:400;line-height:1.55;}
.stem-lab-benefits li::before{content:"";position:absolute;left:0;top:.6em;width:calc(10 * var(--stem-lab-u));height:calc(10 * var(--stem-lab-u));border-radius:50%;background:var(--stem-lab-orange);}
.stem-lab-benefits strong{color:#f4f2ed;font-weight:500;}
.stem-lab-audio-link{align-self:flex-start;margin-top:auto;padding-top:calc(28 * var(--stem-lab-u));color:#f4f2ed!important;font-size:calc(15 * var(--stem-lab-u));font-weight:500;letter-spacing:.035em;text-decoration:none;}
.stem-lab-audio-link:hover{color:var(--stem-lab-orange)!important;}

/* Embedded splitter is a permanent workspace sheet, not a floating modal. */
.audio-stem-modal.stem-lab-embedded{
  --daw-modal-u:var(--stem-lab-u);
  --daw-orange:#ff7300;
  position:relative;
  z-index:auto;
  inset:auto;
  display:block;
  width:100%;
  min-height:100%;
  padding:0;
  background:transparent;
  overflow:visible;
}
.stem-lab-embedded .audio-stem-modal-shell.stem-lab-embedded-shell{
  position:relative;
  isolation:isolate;
  width:100%;
  max-width:none;
  min-height:100%;
  max-height:none;
  padding:calc(211 * var(--stem-lab-u)) calc(36 * var(--stem-lab-u)) calc(34 * var(--stem-lab-u));
  border:0;
  outline:0;
  border-radius:calc(14 * var(--stem-lab-u));
  background:#050506;
  overflow:hidden;
}
.stem-lab-embedded .audio-stem-modal-shell.stem-lab-embedded-shell::before{
  content:"";
  position:absolute;
  z-index:-1;
  left:0;
  right:0;
  top:0;
  height:calc(205 * var(--stem-lab-u));
  background:
    linear-gradient(180deg,rgba(0,0,0,.08) 0%,rgba(0,0,0,.46) 72%,#050506 100%),
    url("../../images/audio-lab/stem-wave-bg.svg?v=1.55556") center top/100% 100% no-repeat;
  opacity:.96;
  pointer-events:none;
}
.stem-lab-embedded .audio-stem-modal-head{position:relative;padding-right:0;margin-bottom:calc(12 * var(--stem-lab-u));}
.stem-lab-embedded .audio-stem-modal-title{display:block;}
.stem-lab-embedded .audio-stem-modal-title h2{font-size:calc(31 * var(--stem-lab-u));line-height:1.05;letter-spacing:.015em;}
.stem-lab-console-title-phone{display:none;}
.stem-lab-embedded .audio-stem-modal-intro{max-width:calc(620 * var(--stem-lab-u));margin:0 0 calc(28 * var(--stem-lab-u));font-size:calc(16 * var(--stem-lab-u));line-height:1.48;color:#b8bbc2;}
.stem-lab-embedded #stemEngineMount{--stem-reference-unit:var(--stem-lab-u);position:relative;z-index:1;}

/* Keep the engine's own controls and classes; remove the modal-ish chrome only here. */
.stem-lab-embedded #stemEngineMount .stemEngineRoot>h2,
.stem-lab-embedded #stemEngineMount .stemEngineRoot>p,
.stem-lab-embedded #stemEngineMount #floatingStatus,
.stem-lab-embedded #stemEngineMount #fileState{display:none!important;}
.stem-lab-embedded #stemEngineMount .stem-source-toolbar{max-width:none;margin-inline:0;gap:calc(14 * var(--stem-lab-u));}
.stem-lab-embedded #stemEngineMount .stem-link-input{height:calc(48 * var(--stem-lab-u));padding:0 calc(16 * var(--stem-lab-u));border:0;border-radius:calc(9 * var(--stem-lab-u));background:#17191f;font-size:calc(16 * var(--stem-lab-u));}
.stem-lab-embedded #stemEngineMount .stem-import-row::before{font-size:calc(13 * var(--stem-lab-u));}
.stem-lab-embedded #stemEngineMount :is(.stem-import-action,.stem-choose-action,.stem-start-action){min-height:calc(48 * var(--stem-lab-u));padding:0 calc(18 * var(--stem-lab-u));border:0;border-radius:calc(9 * var(--stem-lab-u));font-size:calc(16 * var(--stem-lab-u));line-height:1.2;box-shadow:none;}
.stem-lab-embedded #stemEngineMount .stem-import-action,.stem-lab-embedded #stemEngineMount .stem-choose-action{background:#1b1d23;}
.stem-lab-embedded #stemEngineMount .stem-start-action{background:var(--stem-lab-orange);}
.stem-lab-embedded #stemEngineMount .stem-import-action:hover,.stem-lab-embedded #stemEngineMount .stem-choose-action:hover{background:#252830;}
.stem-lab-embedded #stemEngineMount .stem-start-action:hover:not(:disabled){background:#ff7300;}
.stem-lab-embedded #progress.audio-operation-status{display:flex!important;align-items:center;justify-content:center;gap:calc(10 * var(--stem-lab-u));margin:calc(8 * var(--stem-lab-u)) 0 calc(20 * var(--stem-lab-u));padding:calc(12 * var(--stem-lab-u)) calc(16 * var(--stem-lab-u));border:0;border-radius:calc(9 * var(--stem-lab-u));background:#15171c;color:#d7d9de;}
.stem-lab-embedded #progress .audio-operation-spinner{width:calc(23.4 * var(--stem-lab-u));height:calc(23.4 * var(--stem-lab-u));flex:0 0 calc(23.4 * var(--stem-lab-u));border-width:calc(2.6 * var(--stem-lab-u));}

.stem-lab-results{margin-top:calc(24 * var(--stem-lab-u));}
.stem-lab-result-actions{display:flex;align-items:center;gap:calc(6 * var(--stem-lab-u));}
.stem-lab-result-actions .audio-stem-preview{min-width:calc(48 * var(--stem-lab-u));}
body.stem-lab-prototype #app > #floatingStatus.floating{display:none!important;}

/* Portrait tablet/phone: same sheet, stacked. No centered blob. */
@media (orientation:portrait), (max-width:819px){
  .stem-lab-page{--stem-lab-u:.78px;}
  .stem-lab-stage{padding:calc(24 * var(--stem-lab-u)) calc(16 * var(--stem-lab-u)) calc(30 * var(--stem-lab-u));}
  .stem-lab-layout{grid-template-columns:1fr;max-width:none;min-height:0;border-radius:calc(10 * var(--stem-lab-u));}
  .stem-lab-info{padding:calc(28 * var(--stem-lab-u)) calc(34 * var(--stem-lab-u)) calc(24 * var(--stem-lab-u));}
  .stem-lab-console{padding:0 calc(18 * var(--stem-lab-u)) calc(20 * var(--stem-lab-u));background:#13151a;}
  .stem-lab-info h1{font-size:calc(42 * var(--stem-lab-u));}
  .stem-lab-benefits{gap:calc(15 * var(--stem-lab-u));}
  .stem-lab-audio-link{margin-top:calc(24 * var(--stem-lab-u));}
  .stem-lab-embedded .audio-stem-modal-shell.stem-lab-embedded-shell{max-width:none;min-height:calc(390 * var(--stem-lab-u));padding:calc(181 * var(--stem-lab-u)) calc(26 * var(--stem-lab-u)) calc(28 * var(--stem-lab-u));border-radius:calc(12 * var(--stem-lab-u));}
  .stem-lab-embedded .audio-stem-modal-shell.stem-lab-embedded-shell::before{height:calc(175 * var(--stem-lab-u));}
  .stem-lab-embedded .audio-stem-modal-title h2{font-size:calc(28 * var(--stem-lab-u));}
  .stem-lab-embedded .audio-stem-modal-intro{max-width:none;font-size:calc(15 * var(--stem-lab-u));}
  .stem-lab-embedded #stemEngineMount .stem-import-row{display:grid;grid-template-columns:minmax(0,1fr) auto;}
  .stem-lab-embedded #stemEngineMount .stem-file-row{display:grid;grid-template-columns:1fr 1fr;}
}


/* ============================================================================
   STEM LAB | RESULT ACTION GEOMETRY OWNER
   Above phone portrait, PLAY/SAVE and DAW import actions stay on the same
   1280 reference unit as the result rows, waveforms, duration and checkboxes.
   This neutralizes Audio Lab's older 960–1279 landscape clamp locally.
   ============================================================================ */
@media (min-width:820px){
  .stem-lab-embedded .audio-stem-preview,
  .stem-lab-embedded .audio-stem-studio-actions button{
    padding:calc(8 * var(--stem-lab-u)) calc(10 * var(--stem-lab-u));
    border-radius:calc(10 * var(--stem-lab-u));
    font-size:calc(16 * var(--stem-lab-u));
    line-height:1.2;
  }
}

/* Phone-only result stack: tablets keep the landscape row geometry. */
@media (max-width:819px){
  /* Phone portrait reading order: hero → splitter console → feature points. */
  .stem-lab-layout{display:grid;grid-template-columns:1fr;}
  .stem-lab-info{display:contents;}
  .stem-lab-kicker{order:1;padding:calc(28 * var(--stem-lab-u)) calc(34 * var(--stem-lab-u)) 0;margin-bottom:calc(14 * var(--stem-lab-u));box-sizing:border-box;}
  .stem-lab-info h1{order:2;padding:0 calc(34 * var(--stem-lab-u));margin:0 0 calc(24 * var(--stem-lab-u));box-sizing:border-box;}
  .stem-lab-console{order:3;padding:0 calc(18 * var(--stem-lab-u)) calc(20 * var(--stem-lab-u));}
  .stem-lab-benefits{order:4;padding:calc(24 * var(--stem-lab-u)) calc(34 * var(--stem-lab-u)) calc(28 * var(--stem-lab-u));box-sizing:border-box;}
  .stem-lab-console-title-wide{display:none;}
  .stem-lab-console-title-phone{display:inline;}
  .audio-stem-result{grid-template-columns:minmax(calc(96 * var(--stem-lab-u)),auto) minmax(0,1fr) auto;}
  .stem-lab-result-actions{grid-column:1/-1;justify-content:flex-end;}
}

/* ============================================================================
   STEM LAB | TABLET ROTATION SCALE INVARIANT
   Portrait tablets use the long-edge 1280 reference and retain landscape
   typography/control scale. Phone portrait keeps the existing usability floor.
   ============================================================================ */
@media (orientation:portrait) and (min-width:820px){
  .stem-lab-page{--stem-lab-u:.112423780487805vw;font-size:calc(16 * var(--labs-portrait-u));}
  .stem-lab-info h1{font-size:calc(50 * var(--stem-lab-u));}
  .stem-lab-embedded .audio-stem-modal-title h2{font-size:calc(31 * var(--stem-lab-u));}
  .stem-lab-embedded .audio-stem-modal-intro{font-size:calc(16 * var(--stem-lab-u));}
}
