/* A narrow live overview stays above the options when the main lamp is gone. */
.mobile-lamp-preview { display: none; }
.mobile-lamp-preview[hidden] { display: none !important; }

@media (max-width: 720px) {
  :root {
    --mobile-lamp-preview-height: 104px;
    --mobile-lamp-preview-top: calc(env(safe-area-inset-top, 0px) + 8px);
    --mobile-lamp-preview-reserve: calc(var(--mobile-lamp-preview-top) + var(--mobile-lamp-preview-height) + 16px);
  }
  html.has-mobile-lamp-preview { scroll-padding-top: var(--mobile-lamp-preview-reserve); }
  .build-workspace .editor { scroll-margin-top: var(--mobile-lamp-preview-reserve); }
  html.has-mobile-lamp-preview .build-workspace .editor { scroll-margin-top: 0; }
  .mobile-lamp-preview {
    position: fixed;
    z-index: 12;
    top: var(--mobile-lamp-preview-top);
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    height: var(--mobile-lamp-preview-height);
    padding: 8px 10px;
    border: 1px solid var(--red);
    border-radius: var(--ui-panel-radius);
    background: var(--cream);
    box-shadow: 0 5px 20px rgba(40, 28, 21, .12);
    color: var(--red);
    isolation: isolate;
  }
  .mobile-lamp-art {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
  }
  .mobile-lamp-art > svg { display: block; width: 100%; height: 100%; }
  .mobile-lamp-copy { min-width: 0; }
  .mobile-lamp-copy p { margin: 0; }
  .mobile-lamp-copy .small-label { font-size: var(--ui-label); }
  .mobile-lamp-count {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: var(--ui-fine);
    line-height: 1.4;
  }
  .mobile-lamp-part {
    margin-top: 5px !important;
    font-size: var(--ui-compact);
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .mobile-lamp-return {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--red);
    border-radius: 50%;
  }
  .mobile-lamp-return::before {
    position: absolute;
    inset: 6px;
    content: '';
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--cream);
  }
  .mobile-lamp-return .ui-icon { position: relative; width: 16px; height: 16px; }
  .mobile-lamp-return:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
  .mobile-lamp-return:active::before { background: var(--control-wash); }
}

@media (max-width: 720px) and (max-height: 450px) {
  :root { --mobile-lamp-preview-height: 80px; }
  .mobile-lamp-preview { grid-template-columns: 56px minmax(0, 1fr) 44px; padding-block: 5px; }
  .mobile-lamp-part { margin-top: 2px !important; }
}
