/* SolAudioLab Drum Machine mobile app shell V1
   This file intentionally loads after the legacy Drum Machine stylesheet.
   Desktop layout is unchanged. */

.mobile-account-link,
.mobile-info-link,
.mobile-app-status,
.mobile-pattern-new-btn {
  display: none;
}

.setup-radio-row {
  display: none;
}

.setup-track-picker {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(8, 12, 17, .38);
}

.setup-track-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.setup-track-picker-head strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.setup-track-picker-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.setup-track-presets {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.setup-track-toggles {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}

.setup-track-toggle {
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #11161c;
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.setup-track-toggle input {
  margin: 0;
  accent-color: var(--green);
}

.setup-create-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.setup-create-actions .create-btn {
  min-width: 220px;
}

@media (max-width: 760px),
       (max-width: 1024px) and (max-height: 620px) and (orientation: landscape) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body.mobile-focus-active {
    position: relative;
    min-height: var(--sol-mobile-viewport-height, 100svh);
  }

  body.mobile-focus-active .drum-shell {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: var(--sol-mobile-viewport-height, 100svh);
    min-height: 0;
    margin: 0;
    padding:
      max(6px, env(safe-area-inset-top))
      6px
      calc(116px + env(safe-area-inset-bottom));
    display: grid !important;
    grid-template-rows: 46px 38px minmax(0, 1fr);
    gap: 6px !important;
    overflow: hidden !important;
  }

  body.mobile-focus-active:not(.drum-pattern-ready) .drum-shell {
    padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
  }

  body.mobile-focus-active .drum-shell > .site-nav {
    grid-row: 1;
    position: relative !important;
    inset: auto !important;
    z-index: 240;
    min-height: 0 !important;
    height: 46px;
    margin: 0 !important;
    padding: 7px 9px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: center;
    gap: 8px;
    border-radius: 13px !important;
  }

  body.mobile-focus-active .site-brand {
    min-width: 0;
    font-size: 20px !important;
    line-height: 1 !important;
  }

  body.mobile-focus-active .drum-shell > .site-nav .site-links,
  body.mobile-focus-active.mobile-nav-open .drum-shell > .site-nav .site-links {
    display: none !important;
  }

  body.mobile-focus-active .mobile-account-link {
    display: inline-flex;
    min-width: 64px;
    width: auto;
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    align-self: center;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: #11161c;
    color: #dce5f0;
    font-family: inherit;
    font-size: 10px;
    font-weight: 1000;
    line-height: 1;
    letter-spacing: .07em;
    text-decoration: none;
    text-transform: uppercase;
    vertical-align: middle;
  }

  body.mobile-focus-active .mobile-info-link {
    display: inline-flex;
    min-width: 46px;
    width: auto;
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    align-self: center;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: #11161c;
    color: #dce5f0;
    appearance: none;
    font-family: inherit;
    font-size: 10px;
    font-weight: 1000;
    line-height: 1;
    letter-spacing: .07em;
    text-transform: uppercase;
    vertical-align: middle;
  }

  body.mobile-focus-active .mobile-info-link.active,
  body.mobile-focus-active .mobile-info-link[aria-expanded="true"] {
    border-color: rgba(66,211,107,.48);
    color: #a9ffbd;
  }

  body.mobile-focus-active .mobile-account-link::before {
    content: "";
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #8c98a8;
    box-shadow: 0 0 0 3px rgba(140,152,168,.1);
  }

  body.mobile-focus-active .mobile-account-link.is-signed-in {
    border-color: rgba(66,211,107,.42);
    color: #a9ffbd;
  }

  body.mobile-focus-active .mobile-account-link.is-signed-in::before {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(66,211,107,.12);
  }

  body.mobile-focus-active .drum-shell > .mobile-intro:not(.mobile-drawer-content),
  body.mobile-focus-active .drum-shell > .seo-section:not(.mobile-drawer-content),
  body.mobile-focus-active .drum-shell > .related-tools,
  body.mobile-focus-active .drum-shell > .tool-feedback,
  body.mobile-focus-active .drum-shell > .site-footer,
  body.mobile-focus-active .tool-feedback-float {
    display: none !important;
  }

  body.mobile-focus-active .mobile-app-status {
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    padding: 5px 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: linear-gradient(180deg, #1b2129, #12171d);
    box-shadow: var(--inset);
  }

  body.mobile-focus-active .mobile-app-status > div {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 7px;
  }

  body.mobile-focus-active .mobile-app-status span {
    flex: 0 0 auto;
    color: var(--dim);
    font-size: 8px;
    font-weight: 1000;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  body.mobile-focus-active .mobile-app-status strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.mobile-focus-active .mobile-app-status .mobile-bar-brief {
    padding: 4px 7px;
    border: 1px solid rgba(66,211,107,.24);
    border-radius: 999px;
    color: var(--green);
    background: rgba(66,211,107,.06);
    letter-spacing: .04em;
  }

  body.mobile-focus-active .drum-shell > .setup-card,
  body.mobile-focus-active .drum-shell > .machine-app {
    grid-row: 3;
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
  }

  body.mobile-focus-active .drum-shell > .setup-card:not(.mobile-drawer-content) {
    height: 100%;
    padding: 14px !important;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.mobile-focus-active:not(.drum-pattern-ready) .drum-shell > .setup-card:not(.mobile-drawer-content) {
    display: block !important;
  }

  body.mobile-focus-active:not(.drum-pattern-ready) .drum-shell > .machine-app,
  body.mobile-focus-active.drum-pattern-ready .drum-shell > .setup-card:not(.mobile-drawer-content) {
    display: none !important;
  }

  body.mobile-focus-active.drum-pattern-ready .drum-shell > .machine-app {
    display: grid !important;
  }

  body.mobile-focus-active .drum-shell > .setup-card:not(.mobile-drawer-content) .setup-grid {
    grid-template-columns: 1fr !important;
  }

  body.mobile-focus-active .setup-time-select {
    display: none !important;
  }

  body.mobile-focus-active .setup-step-buttons,
  body.mobile-focus-active .setup-bars-buttons {
    display: none !important;
  }

  body.mobile-focus-active .setup-radio-row {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  body.mobile-focus-active .setup-radio-row .segmented {
    display: grid;
  }

  body.mobile-focus-active .setup-time-buttons .segmented {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  body.mobile-focus-active .setup-step-radios .segmented {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  body.mobile-focus-active .setup-bars-radios .segmented {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.mobile-focus-active .setup-radio-row legend {
    padding: 0;
    color: var(--dim);
    font-size: 10px;
    font-weight: 950;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  body.mobile-focus-active .setup-radio-row .segmented label {
    min-width: 0;
    position: relative;
    z-index: 1;
    display: block;
    touch-action: manipulation;
  }

  body.mobile-focus-active .setup-radio-row input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  body.mobile-focus-active .setup-radio-row span {
    min-height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #202734;
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
    box-shadow: var(--inset);
  }

  body.mobile-focus-active .setup-radio-row input:checked + span {
    color: #fff;
    border-color: #ff5260;
    background: linear-gradient(180deg, #ff3040, #93000a);
  }

  body.mobile-focus-active .setup-radio-row input:focus-visible + span {
    outline: 2px solid #fff;
    outline-offset: 2px;
  }

  body.mobile-focus-active .setup-track-picker {
    margin-top: 10px;
    padding: 10px;
  }

  body.mobile-focus-active .setup-track-picker-head {
    align-items: center;
  }

  body.mobile-focus-active .setup-track-toggles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  body.mobile-focus-active .setup-track-toggle {
    min-height: 34px;
    padding: 6px 7px;
    font-size: 10px;
  }

  body.mobile-focus-active .setup-create-actions,
  body.mobile-focus-active .setup-create-actions .create-btn {
    width: 100%;
  }

  body.mobile-focus-active .mobile-drawer .mobile-pattern-new-btn {
    margin-top: 4px;
    display: block !important;
    width: 100%;
    min-height: 38px;
    border-color: rgba(255, 82, 96, .42);
    color: #ffd7da;
  }

  body.mobile-focus-active .machine-app {
    height: 100%;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  body.mobile-focus-active .machine-app[hidden],
  body.mobile-focus-active .setup-card[hidden] {
    display: none !important;
  }

  body.mobile-focus-active .machine-app > .topbar,
  body.mobile-focus-active .machine-app > .bar-strip,
  body.mobile-focus-active .machine-app > .lower-panels {
    display: none !important;
  }

  body.mobile-focus-active .editor-panel {
    box-sizing: border-box;
    min-width: 0;
    min-height: 0 !important;
    height: 100% !important;
    padding: 6px !important;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
  }

  body.mobile-focus-active .editor-head,
  body.mobile-focus-active .editor-panel > .rows-panel:not(.mobile-drawer-content),
  body.mobile-focus-active .landscape-note,
  body.mobile-focus-active .overview {
    display: none !important;
  }

  body.mobile-focus-active .mobile-editor-strip.mobile-bar-access {
    flex: 0 0 auto;
    margin: 0 0 5px !important;
    padding: 5px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 4px !important;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: #11161c;
  }

  body.mobile-focus-active .mobile-inline-bar-tab,
  body.mobile-focus-active .mobile-bar-action {
    min-height: 29px !important;
    border-radius: 8px !important;
    font-size: 9px !important;
  }

  body.mobile-focus-active .sequencer-frame {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: auto !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    overscroll-behavior: contain;
    border-radius: 12px;
  }

  body.mobile-focus-active .step-header,
  body.mobile-focus-active .track-grid {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.mobile-focus-active .step-header,
  body.mobile-focus-active .track-row {
    grid-template-columns: clamp(76px, 22vw, 104px) repeat(var(--steps), minmax(0, 1fr)) !important;
    gap: 2px !important;
  }

  body.mobile-focus-active .step-header {
    flex: 0 0 auto;
    padding: 6px 5px 5px !important;
  }

  body.mobile-focus-active .step-cell {
    min-width: 0 !important;
    padding: 4px 0 !important;
    overflow: hidden;
    font-size: clamp(6px, 1.8vw, 9px) !important;
  }

  body.mobile-focus-active .track-scroll {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 5px 5px 58px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  body.mobile-focus-active .track-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  body.mobile-focus-active .track-name {
    min-width: 0;
    padding: 5px !important;
    font-size: clamp(8px, 2.15vw, 10px) !important;
  }

  body.mobile-focus-active .step-button {
    min-width: 0 !important;
    min-height: 40px !important;
    border-radius: 6px !important;
  }

  body.mobile-focus-active .drum-shell > .mobile-focus-toolbar {
    position: fixed !important;
    top: auto !important;
    left: 6px !important;
    right: 6px !important;
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    z-index: 220;
    height: 50px;
    margin: 0 !important;
    padding: 5px !important;
    display: none !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.06fr) minmax(0, 1.18fr) !important;
    gap: 5px !important;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px !important;
    background: rgba(17,22,28,.97);
    box-shadow: 0 16px 36px rgba(0,0,0,.5), var(--inset);
    backdrop-filter: blur(12px);
  }

  body.mobile-focus-active.drum-pattern-ready .drum-shell > .mobile-focus-toolbar {
    display: grid !important;
  }

  body.mobile-focus-active .mobile-panel-btn {
    min-width: 0;
    min-height: 38px;
    padding: 5px 3px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
    letter-spacing: .04em !important;
  }

  body.mobile-focus-active .mobile-panel-btn[data-mobile-panel="presets"],
  body.mobile-focus-active .mobile-panel-btn[data-mobile-panel="save"] {
    padding-inline: 2px !important;
    font-size: 9px !important;
    letter-spacing: .02em !important;
    white-space: nowrap;
  }

  body.mobile-focus-active .mobile-info-about,
  body.mobile-focus-active .mobile-info-related,
  body.mobile-focus-active .mobile-info-feedback {
    display: grid;
    gap: 7px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.12);
  }

  body.mobile-focus-active .mobile-info-about h3 {
    margin: 4px 0 0;
    color: #fff;
    font-size: 14px;
  }

  body.mobile-focus-active .mobile-info-related a {
    min-height: 48px;
    padding: 9px 10px;
    display: grid;
    gap: 3px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 10px;
    background: #11161c;
    color: #dce5f0;
    text-decoration: none;
  }

  body.mobile-focus-active .mobile-info-related a span {
    color: rgba(235,240,247,.72);
    font-size: 11px;
    line-height: 1.35;
  }

  body.mobile-focus-active .mobile-info-related .mobile-info-all-tools {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9bffb3;
    font-weight: 900;
  }

  body.mobile-focus-active .mobile-info-feedback .btn {
    width: 100%;
    margin-top: 2px;
  }

  body.mobile-focus-active .mobile-drawer .tool-feedback.mobile-drawer-content {
    display: block !important;
    margin: 0 !important;
  }

  body.mobile-focus-active .mobile-panel-btn.active,
  body.mobile-focus-active .mobile-panel-btn[aria-expanded="true"] {
    color: #fff !important;
    border-color: rgba(66,211,107,.58) !important;
    background: linear-gradient(180deg, #2f8d49, #18572d) !important;
  }

  body.mobile-focus-active .drum-shell > .mobile-transport {
    position: fixed !important;
    left: 6px !important;
    right: 6px !important;
    bottom: calc(62px + env(safe-area-inset-bottom)) !important;
    z-index: 215;
    box-sizing: border-box;
    height: 50px;
    margin: 0 !important;
    padding: 5px !important;
    display: none !important;
    grid-template-columns: 70px minmax(0, 1fr) 48px 48px !important;
    gap: 5px !important;
    border-radius: 14px !important;
  }

  body.mobile-focus-active.drum-pattern-ready .drum-shell > .mobile-transport {
    display: grid !important;
  }

  body.mobile-focus-active .mobile-bpm,
  body.mobile-focus-active .mobile-play,
  body.mobile-focus-active .mobile-step {
    min-height: 38px !important;
    border-radius: 10px !important;
  }

  body.mobile-focus-active .mobile-bpm {
    padding: 3px !important;
  }

  body.mobile-focus-active .mobile-bpm strong {
    font-size: 21px !important;
  }

  body.mobile-focus-active .mobile-play {
    font-size: 16px !important;
  }

  body.mobile-focus-active .mobile-drawer {
    position: fixed !important;
    inset:
      calc(max(6px, env(safe-area-inset-top)) + 52px)
      6px
      max(6px, env(safe-area-inset-bottom))
      6px !important;
    z-index: 320 !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-rows: 54px minmax(0, 1fr);
    overflow: hidden !important;
    border: 1px solid rgba(255,255,255,.2) !important;
    border-radius: 15px !important;
    background: #151b22 !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.68) !important;
  }

  body.mobile-focus-active .mobile-drawer[hidden] {
    display: none !important;
  }

  body.mobile-focus-active .mobile-drawer::before {
    display: none !important;
  }

  body.mobile-focus-active .mobile-drawer-head {
    min-height: 0 !important;
    padding: 8px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    border-bottom: 1px solid var(--line-soft);
    background: #1b222b;
  }

  body.mobile-focus-active .mobile-drawer-head .btn {
    min-height: 36px;
    padding: 6px 12px !important;
  }

  body.mobile-focus-active .mobile-drawer-body {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 10px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  body.mobile-focus-active .mobile-drawer-content,
  body.mobile-focus-active .mobile-drawer-content.tool-panel,
  body.mobile-focus-active .mobile-drawer-content.setup-card {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.mobile-focus-active .mobile-drawer .topbar.mobile-drawer-content {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  body.mobile-focus-active .mobile-drawer .transport {
    grid-template-columns: 70px minmax(88px, 1fr) repeat(4, 38px) !important;
  }

  body.mobile-focus-active .mobile-drawer .top-settings {
    grid-template-columns: 90px minmax(0, 1fr) !important;
  }

  body.mobile-focus-active .mobile-drawer .rows-panel.mobile-drawer-content,
  body.mobile-focus-active .mobile-drawer [data-mobile-source="presets"].mobile-drawer-content,
  body.mobile-focus-active .mobile-drawer [data-mobile-source="save"].mobile-drawer-content {
    display: block !important;
  }

  body.mobile-focus-active .mobile-drawer .row-toggles,
  body.mobile-focus-active .mobile-drawer .preset-grid,
  body.mobile-focus-active .mobile-drawer .save-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.mobile-focus-active [data-mobile-source="save"] .save-grid {
    display: grid !important;
  }

  body.mobile-focus-active [data-mobile-source="save"] .cloud-pattern-box {
    display: block !important;
  }

  body.mobile-focus-active.drawer-open .drum-shell > .mobile-focus-toolbar,
  body.mobile-focus-active.drawer-open .drum-shell > .mobile-transport {
    visibility: hidden;
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  body.mobile-focus-active .drum-shell {
    grid-template-rows: 44px 36px minmax(0, 1fr);
    padding-left: 5px !important;
    padding-right: 5px !important;
  }

  body.mobile-focus-active .drum-shell > .site-nav {
    height: 44px;
  }

  body.mobile-focus-active .step-header,
  body.mobile-focus-active .track-grid {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.mobile-focus-active .step-header,
  body.mobile-focus-active .track-row {
    grid-template-columns: 76px repeat(var(--steps), minmax(0, 1fr)) !important;
    gap: 2px !important;
  }

  body.mobile-focus-active .mobile-drawer .transport {
    grid-template-columns: 64px minmax(80px, 1fr) repeat(4, 34px) !important;
    gap: 4px !important;
  }
}

@media (max-width: 1024px) and (max-height: 620px) and (orientation: landscape) {
  body.mobile-focus-active .drum-shell {
    grid-template-rows: 40px 30px minmax(0, 1fr);
    padding:
      max(4px, env(safe-area-inset-top))
      5px
      calc(98px + env(safe-area-inset-bottom)) !important;
    gap: 4px !important;
  }

  body.mobile-focus-active .drum-shell > .site-nav {
    height: 40px;
    padding: 5px 8px !important;
  }

  body.mobile-focus-active .mobile-app-status {
    padding: 3px 8px;
  }

  body.mobile-focus-active .track-scroll {
    padding-bottom: 5px !important;
  }

  body.mobile-focus-active .mobile-editor-strip.mobile-bar-access {
    grid-template-columns: minmax(0, 1fr) minmax(250px, .7fr) !important;
    align-items: center !important;
  }

  body.mobile-focus-active .drum-shell > .mobile-transport {
    bottom: calc(52px + env(safe-area-inset-bottom)) !important;
    height: 42px !important;
  }

  body.mobile-focus-active .drum-shell > .mobile-focus-toolbar {
    top: auto !important;
    bottom: max(5px, env(safe-area-inset-bottom)) !important;
    height: 42px !important;
  }

  body.mobile-focus-active .mobile-panel-btn,
  body.mobile-focus-active .mobile-bpm,
  body.mobile-focus-active .mobile-play,
  body.mobile-focus-active .mobile-step {
    min-height: 30px !important;
  }

  body.mobile-focus-active .mobile-drawer {
    inset:
      calc(max(4px, env(safe-area-inset-top)) + 44px)
      5px
      max(5px, env(safe-area-inset-bottom))
      5px !important;
  }
}

/* V1.0.13 New Pattern responsive density
   Use every desktop grid column, keep Steps per Bar on one line, and turn the
   mobile choices into compact segmented rails instead of separate button cards. */
@media (min-width: 1161px) {
  .setup-grid {
    grid-template-columns:
      minmax(220px, 1.45fr)
      minmax(90px, .62fr)
      minmax(105px, .7fr)
      minmax(330px, 2.05fr)
      minmax(150px, .9fr);
  }

  .setup-step-buttons .segmented,
  .setup-bars-buttons .segmented {
    display: grid;
    gap: 4px;
  }

  .setup-step-buttons .segmented {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .setup-bars-buttons .segmented {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .setup-step-buttons .segmented button,
  .setup-bars-buttons .segmented button {
    min-width: 0;
    width: 100%;
    padding-right: 4px;
    padding-left: 4px;
  }
}

@media (min-width: 761px) and (max-width: 1160px) {
  .setup-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .setup-grid > .name-row {
    grid-column: 1 / 5;
  }

  .setup-grid > .input-row:nth-child(2) {
    grid-column: 5 / 7;
  }

  .setup-grid > .setup-time-select {
    grid-column: 7 / 9;
  }

  .setup-grid > .setup-bars-buttons {
    grid-column: 9 / -1;
    grid-row: 1;
  }

  .setup-grid > .setup-step-buttons {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .setup-step-buttons .segmented,
  .setup-bars-buttons .segmented {
    display: grid;
    gap: 5px;
  }

  .setup-step-buttons .segmented {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .setup-bars-buttons .segmented {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .setup-step-buttons .segmented button,
  .setup-bars-buttons .segmented button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 760px),
       (max-width: 1024px) and (max-height: 620px) and (orientation: landscape) {
  body.mobile-focus-active .drum-shell > .setup-card:not(.mobile-drawer-content) {
    padding: 10px !important;
  }

  body.mobile-focus-active .drum-shell > .setup-card:not(.mobile-drawer-content) .setup-grid {
    gap: 7px !important;
    margin-top: 9px;
  }

  body.mobile-focus-active .setup-grid .input-row {
    gap: 4px;
  }

  body.mobile-focus-active .setup-grid .input-row input,
  body.mobile-focus-active .setup-grid .input-row select {
    min-height: 38px;
    padding: 8px 10px;
  }

  body.mobile-focus-active .setup-radio-row .segmented {
    gap: 0;
    margin-top: 4px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #161c24;
    box-shadow: var(--inset);
  }

  body.mobile-focus-active .setup-step-radios .segmented {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  body.mobile-focus-active .setup-radio-row span {
    min-height: 34px;
    border: 0 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.mobile-focus-active .setup-radio-row .segmented label + label span {
    border-left: 1px solid var(--line-soft) !important;
  }

  body.mobile-focus-active .setup-radio-row input:checked + span {
    border-left-color: #ff5260 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 82, 96, .42);
  }

  body.mobile-focus-active .setup-track-picker {
    margin-top: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  body.mobile-focus-active .setup-track-picker-head p {
    margin-top: 3px;
    line-height: 1.3;
  }

  body.mobile-focus-active .setup-track-toggles {
    margin-top: 7px;
    gap: 4px;
  }

  body.mobile-focus-active .setup-track-toggle {
    min-height: 32px;
    padding: 5px 6px;
  }

  body.mobile-focus-active .setup-create-actions {
    margin-top: 8px;
  }
}

@media (max-width: 380px) and (orientation: portrait) {
  body.mobile-focus-active .setup-radio-row span {
    min-height: 32px;
    font-size: 11px;
  }
}
