:root{--jp-deck-columns:3;--jp-wishlist-columns:2}
.jp-library-mobile-overview,.jp-library-mobile-detail-header{display:none}
@media(max-width:680px){
  /* The old horizontal workspace switchers are superseded by the dedicated
     mobile overview screens. Keeping both rendered caused the duplicate deck/
     wishlist rows visible in the screenshots. */
  #jpDeckSwitcher,#jpWishlistSwitcher{display:none!important}
  body.jp-deck-overview-open #deckWorkspace{display:none!important}
  body.jp-wishlist-overview-open #wishlistWorkspace{display:none!important}
  body.jp-deck-overview-open #jpDecksMobileOverview{display:grid!important}
  body.jp-wishlist-overview-open #jpWishlistsMobileOverview{display:grid!important}

  #jpMobileNav .jp-wishlist-nav-button::before{content:"♡"!important;font-size:1.35rem!important;line-height:1!important}
  .jp-library-mobile-overview{display:grid;gap:12px}
  .jp-library-page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-direction:column;padding:2px 0}
  .jp-library-page-head h1{margin:2px 0 4px;font-size:1.65rem;line-height:1.08}
  .jp-library-page-head p{margin:0;color:var(--muted);font-size:.8rem;line-height:1.35}
  .jp-library-page-head>.btn{width:100%;min-height:42px}
  .jp-library-overview-list{display:grid;gap:8px}
  .jp-library-overview-card{appearance:none;display:grid;grid-template-columns:50px minmax(0,1fr) auto;align-items:center;gap:11px;width:100%;min-height:72px;padding:10px 12px;border:1px solid var(--line);border-radius:15px;background:linear-gradient(180deg,#0e1928,#0b1420);color:var(--text);text-align:left;box-shadow:0 6px 18px rgba(0,0,0,.14)}
  .jp-library-overview-card:active{transform:translateY(1px)}
  .jp-library-card-icon{display:grid;place-items:center;width:50px;height:50px;overflow:hidden;border-radius:12px;background:#0b2031;color:#68d5ff;font-size:1.25rem}
  .jp-library-card-icon img{width:100%;height:100%;object-fit:cover}
  .jp-library-card-copy{display:grid;gap:3px;min-width:0}
  .jp-library-card-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.95rem}
  .jp-library-card-copy small{color:var(--muted);font-size:.7rem}
  .jp-library-card-arrow{font-size:1.55rem;color:#d7ebff}

  body.jp-deck-detail-open .topbar,body.jp-wishlist-detail-open .topbar{display:none!important}
  body.jp-deck-detail-open #jpDecksMobileOverview,body.jp-wishlist-detail-open #jpWishlistsMobileOverview{display:none!important}

  #deckWorkspace,#wishlistWorkspace{overflow:visible!important}
  .jp-library-mobile-detail-header{position:sticky;z-index:520;top:0;display:grid;gap:8px;margin:-15px -15px 10px;padding:8px 10px 9px;border-bottom:1px solid rgba(139,220,255,.12);background:rgba(7,13,22,.96);box-shadow:0 8px 20px rgba(0,0,0,.2);backdrop-filter:blur(18px)}
  .jp-library-titlebar{display:grid;grid-template-columns:38px minmax(0,1fr) 38px;align-items:center;gap:8px}
  .jp-library-back-button,.jp-library-menu-button{appearance:none;display:grid;place-items:center;width:38px;height:38px;padding:0;border:1px solid var(--line-soft);border-radius:11px;background:#0d1827;color:var(--text);font:inherit;font-weight:850}
  .jp-library-back-button{font-size:1.65rem;line-height:1}.jp-library-menu-button{font-size:1rem;letter-spacing:.05em}
  .jp-library-titlecopy{display:grid;gap:1px;min-width:0}
  .jp-library-titlecopy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1rem;line-height:1.15}
  .jp-library-titlecopy span{color:var(--muted);font-size:.66rem}

  .jp-library-searchbar{display:grid;grid-template-columns:24px minmax(0,1fr) 30px;align-items:center;min-height:42px;border:1px solid var(--line);border-radius:12px;background:#07101a;overflow:hidden}
  .jp-library-searchbar>span{display:grid;place-items:center;color:#8aa1b9;font-size:1.05rem}
  .jp-library-searchbar input{width:100%;min-width:0;height:40px;padding:0 4px;border:0!important;outline:0!important;background:transparent!important;box-shadow:none!important;color:var(--text);font-size:.82rem}
  .jp-library-searchbar button{appearance:none;width:30px;height:40px;border:0;background:transparent;color:#8ba0b7;font-size:1rem}

  .jp-library-mobile-menu{position:absolute;top:54px;right:10px;width:min(290px,calc(100vw - 28px));padding:9px;border:1px solid rgba(139,220,255,.18);border-radius:15px;background:rgba(10,18,30,.99);box-shadow:0 18px 44px rgba(0,0,0,.48)}
  .jp-library-mobile-menu[hidden]{display:none!important}
  .jp-library-menu-actions{display:grid;gap:6px}
  .jp-library-menu-actions button{appearance:none;min-height:39px;padding:8px 10px;border:1px solid var(--line-soft);border-radius:10px;background:#101b2a;color:var(--text);text-align:left;font-weight:760}
  .jp-library-menu-actions button:first-child{background:linear-gradient(135deg,#48c7fa,#347df4);border-color:transparent;color:#04111a}
  .jp-library-menu-actions button.danger{border-color:rgba(255,120,120,.35);background:#241416;color:#ffb4b4}
  .jp-library-menu-section{display:grid;gap:7px;margin-top:8px;padding-top:8px;border-top:1px solid var(--line-soft)}
  .jp-library-menu-labelrow{display:flex;align-items:center;justify-content:space-between;gap:10px}
  .jp-library-menu-labelrow span{color:var(--muted);font-size:.68rem}.jp-library-menu-labelrow strong{font-size:.7rem}
  .jp-library-menu-section input[type=range]{width:100%;accent-color:var(--accent)}

  body.jp-deck-detail-open #deckWorkspace>.deck-workspace-head{display:none!important}
  body.jp-deck-detail-open #deckWorkspace>.deck-mode-grid{display:none!important}
  body.jp-deck-detail-open #deckWorkspace{padding:15px!important;border-radius:0!important;border-left:0!important;border-right:0!important;background:#09111b!important;box-shadow:none!important}
  body.jp-deck-detail-open #deckWorkspace .deck-workspace-actions{display:none!important}
  body.jp-deck-detail-open #deckWorkspace .deck-card-grid{grid-template-columns:repeat(var(--jp-deck-columns),minmax(0,1fr))!important;gap:7px!important}
  body.jp-deck-detail-open #deckWorkspace .deck-role-row-cards{grid-template-columns:repeat(var(--jp-deck-columns),minmax(0,1fr))!important;gap:7px!important}
  body.jp-deck-detail-open #deckWorkspace .deck-layout-groups{grid-template-columns:repeat(var(--jp-deck-columns),minmax(0,1fr))!important;gap:8px!important}
  body.jp-deck-detail-open #deckWorkspace .deck-layout-group{min-width:0!important}
  body.jp-deck-detail-open #deckWorkspace .deck-layout-card{border-radius:8px!important}
  body.jp-deck-detail-open #deckWorkspace .deck-layout-toolbar{gap:8px;align-items:flex-start;flex-direction:column;margin-bottom:10px}
  body.jp-deck-detail-open #deckWorkspace .deck-layout-buttons{gap:5px}
  body.jp-deck-detail-open #deckWorkspace .deck-layout-buttons button{padding:6px 8px;font-size:.68rem}
  body.jp-deck-detail-open #deckWorkspace .deck-enhanced-layout{margin-top:10px}
  body.jp-deck-detail-open #deckWorkspace .deck-rows-with-sidebar{grid-template-columns:1fr!important}
  body.jp-deck-detail-open #deckWorkspace .deck-compact-stats{position:static}

  body.jp-wishlist-detail-open #wishlistWorkspace{padding:15px!important;border-radius:0!important;border-left:0!important;border-right:0!important;background:#09111b!important;box-shadow:none!important}
  body.jp-wishlist-detail-open #wishlistWorkspace>.workspace-head{display:none!important}
  body.jp-wishlist-detail-open #wishlistWorkspace>.collection-toolbar{display:none!important}
  body.jp-wishlist-detail-open #wishlistWorkspaceGrid{grid-template-columns:repeat(var(--jp-wishlist-columns),minmax(0,1fr))!important;gap:7px!important;margin-top:6px!important}
  body.jp-wishlist-detail-open .wishlist-workspace-card{border-radius:9px!important;min-width:0}
  body.jp-wishlist-detail-open .wishlist-workspace-image{aspect-ratio:5/7}
  body.jp-wishlist-detail-open .wishlist-workspace-copy{gap:5px;padding:7px}
  body.jp-wishlist-detail-open .wishlist-workspace-copy>strong{font-size:.72rem;line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  body.jp-wishlist-detail-open .wishlist-workspace-copy>small{font-size:.6rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  body.jp-wishlist-detail-open .wishlist-card-actions{display:grid;grid-template-columns:1fr;gap:4px}
  body.jp-wishlist-detail-open .wishlist-card-actions label{font-size:.58rem}
  body.jp-wishlist-detail-open .wishlist-card-actions input{width:100%;min-width:0;padding:5px 6px;font-size:.68rem}
  body.jp-wishlist-detail-open .wishlist-card-actions .btn{width:100%;min-height:28px;padding:4px 5px;font-size:.6rem}
}

@media(max-width:680px){
  .jp-library-loading{padding:18px;border:1px dashed var(--line);border-radius:14px;color:var(--muted);font-size:.78rem;text-align:center}
}

@media(max-width:680px){
  body.jp-deck-detail-open #deckWorkspace .deck-layout-groups-stacks{
    gap:6px!important;
    align-items:start!important;
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-group-stack{
    min-width:0!important;
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-group-stack .deck-layout-group-head{
    gap:4px!important;
    margin-bottom:4px!important;
    min-width:0
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-group-stack .deck-layout-group-head strong{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:.78rem;
    line-height:1.05
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-group-stack .deck-layout-group-head span{
    flex:0 0 auto;
    font-size:.62rem
  }

  body.jp-deck-detail-open #deckWorkspace .deck-card-stack{
    --jp-stack-step:20px;
    min-height:0!important;
    height:calc(var(--jp-mobile-stack-card-height,150px) + (var(--stack-count) - 1)*var(--jp-stack-step))!important;
    transition:height .22s ease
  }
  body.jp-deck-detail-open #deckWorkspace .deck-card-stack.has-mobile-reveal{
    height:calc(var(--jp-mobile-stack-card-height,150px) + var(--jp-mobile-stack-card-height,150px) + (var(--stack-count) - 2)*var(--jp-stack-step))!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-stack-card{
    top:calc(var(--stack-index)*var(--jp-stack-step))!important;
    transition:transform .22s ease,box-shadow .22s ease!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-stack-card:hover~.deck-stack-card,
  body.jp-deck-detail-open #deckWorkspace .deck-stack-card:focus-visible~.deck-stack-card{
    transform:none!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-stack-card.is-mobile-revealed{
    box-shadow:0 12px 28px rgba(0,0,0,.42)!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-stack-card.is-mobile-revealed~.deck-stack-card{
    transform:translateY(calc(var(--jp-mobile-stack-card-height,150px) - var(--jp-stack-step)))!important
  }
}

@media(max-width:680px){
  body.jp-wishlist-detail-open #wishlistWorkspaceGrid{
    align-items:start!important;
    grid-auto-rows:auto!important;
  }

  body.jp-wishlist-detail-open .jp-mobile-wishlist-card{
    overflow:hidden!important;
    min-width:0!important;
    border-radius:9px!important;
    background:#0b1420!important;
    content-visibility:auto;
    contain-intrinsic-size:180px 120px;
    transition:opacity .16s ease,border-color .16s ease
  }
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card[hidden]{display:none!important}
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card.is-removing{opacity:.35;pointer-events:none}
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card.jp-mobile-wishlist-error{
    border-color:rgba(255,100,100,.75)!important;
    box-shadow:0 0 0 1px rgba(255,100,100,.18)
  }

  body.jp-wishlist-detail-open .jp-mobile-wishlist-card .wishlist-workspace-image{
    position:relative!important;
    aspect-ratio:488/680!important;
    overflow:hidden!important;
    border-radius:8px 8px 0 0!important;
    background:#09111b!important
  }
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card .wishlist-workspace-image img,
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card .wishlist-no-image{
    width:100%!important;
    height:100%!important;
    display:block!important;
    object-fit:cover!important
  }
  body.jp-wishlist-detail-open .jp-mobile-wishlist-placeholder{
    font-size:.54rem!important;
    color:#6f8298!important;
    text-align:center!important;
    padding:4px!important
  }

  body.jp-wishlist-detail-open .jp-mobile-wishlist-trash{
    position:absolute;
    z-index:5;
    top:4px;
    right:4px;
    display:grid;
    place-items:center;
    width:clamp(20px,6.4vw,28px);
    height:clamp(20px,6.4vw,28px);
    padding:0;
    border:1px solid rgba(255,150,150,.28);
    border-radius:999px;
    background:rgba(20,8,10,.82);
    color:#ffb7b7;
    box-shadow:0 2px 8px rgba(0,0,0,.35);
    backdrop-filter:blur(6px)
  }
  body.jp-wishlist-detail-open .jp-mobile-wishlist-trash svg{
    width:56%;
    height:56%;
    fill:currentColor
  }

  body.jp-wishlist-detail-open .jp-mobile-wishlist-qty{
    position:absolute;
    z-index:5;
    right:4px;
    bottom:4px;
    display:grid;
    grid-template-columns:auto auto auto;
    align-items:center;
    gap:2px;
    padding:2px;
    border:1px solid rgba(139,220,255,.25);
    border-radius:999px;
    background:rgba(5,11,18,.86);
    box-shadow:0 2px 8px rgba(0,0,0,.36);
    backdrop-filter:blur(6px)
  }
  body.jp-wishlist-detail-open .jp-mobile-wishlist-qty button{
    appearance:none;
    display:grid;
    place-items:center;
    width:clamp(18px,5.4vw,24px);
    height:clamp(18px,5.4vw,24px);
    padding:0;
    border:0;
    border-radius:999px;
    background:rgba(73,190,242,.12);
    color:#dff8ff;
    font:inherit;
    font-size:clamp(.66rem,2.7vw,.82rem);
    font-weight:900;
    line-height:1
  }
  body.jp-wishlist-detail-open .jp-mobile-wishlist-qty strong{
    min-width:1.2em;
    color:#fff;
    font-size:clamp(.55rem,2.25vw,.72rem);
    line-height:1;
    text-align:center
  }

  body.jp-wishlist-detail-open .jp-mobile-wishlist-source{
    min-width:0;
    padding:5px 5px 6px;
    color:#8fa3ba;
    font-size:clamp(.5rem,2.05vw,.64rem);
    line-height:1.12;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis
  }

  body.jp-wishlist-detail-open .jp-mobile-wishlist-card .wishlist-workspace-copy,
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card .wishlist-card-actions,
  body.jp-wishlist-detail-open .jp-mobile-wishlist-card>.qty-badge{
    display:none!important
  }

  body.jp-wishlist-detail-open .wishlist-load-more{display:none!important}
}

/* App-styled replacements for native browser dialogs */
.jp-app-confirm-dialog,.jp-app-prompt-dialog{max-width:520px}
.jp-app-confirm-dialog h2,.jp-app-prompt-dialog h2{margin:6px 0 8px}
.jp-app-confirm-dialog p{line-height:1.5}
.jp-app-prompt-label{display:grid;gap:6px;color:var(--muted);font-size:.78rem}
.jp-app-prompt-label input{width:100%;min-height:44px;border:1px solid var(--line);border-radius:11px;background:#08121e;color:var(--text);padding:9px 11px;font:inherit}

@media(max-width:680px){
  /* The opened deck should lead with its cards, not with the large desktop
     commander/planning setup. Those sections remain available via •••. */
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace .commander-selected-card,
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace .commander-picker,
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace #jpDualCommanderHost{
    display:none!important
  }

  body.jp-deck-detail-open #deckWorkspace .deck-enhanced-layout{
    margin-top:4px!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-toolbar{
    display:none!important
  }

  .jp-deck-mobile-viewbar{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:5px
  }
  .jp-deck-mobile-viewbar button{
    appearance:none;
    min-width:0;
    min-height:32px;
    padding:5px 4px;
    border:1px solid var(--line-soft);
    border-radius:9px;
    background:#0b1623;
    color:#91a6bd;
    font:inherit;
    font-size:.63rem;
    font-weight:800;
    white-space:nowrap
  }
  .jp-deck-mobile-viewbar button.active{
    border-color:rgba(56,189,248,.42);
    background:rgba(56,189,248,.12);
    color:#dff8ff
  }

  #jpDeckMobileHeader .jp-library-mobile-menu{
    top:94px
  }
  #jpDeckMobileHeader .jp-library-menu-section>label{
    color:var(--muted);
    font-size:.68rem
  }
  #jpDeckMobileHeader .jp-library-menu-section select{
    width:100%;
    min-height:38px;
    padding:7px 9px;
    border:1px solid var(--line-soft);
    border-radius:9px;
    background:#0d1827;
    color:var(--text);
    font:inherit;
    font-size:.76rem
  }

  /* Desktop hover preview has no useful meaning on touch devices. The list
     itself remains, and tapping a row opens the existing card detail dialog. */
  body.jp-deck-detail-open #deckWorkspace .deck-preview-layout{
    grid-template-columns:1fr!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-preview-pane,
  body.jp-deck-detail-open #deckWorkspace .deck-floating-preview{
    display:none!important
  }

  body.jp-deck-detail-open #deckWorkspace .deck-preview-list,
  body.jp-deck-detail-open #deckWorkspace .deck-text-hover-list{
    min-width:0!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-list-row{
    grid-template-columns:auto minmax(0,1fr) auto!important;
    gap:6px!important;
    min-height:34px!important;
    padding:5px 7px!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-list-row .deck-layout-list-type{
    display:none!important
  }
  body.jp-deck-detail-open #deckWorkspace .deck-layout-list-row strong{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap
  }

  body.jp-deck-detail-open.jp-deck-mobile-settings-visible #deckWorkspace .commander-selected-card,
  body.jp-deck-detail-open.jp-deck-mobile-settings-visible #deckWorkspace .commander-picker,
  body.jp-deck-detail-open.jp-deck-mobile-settings-visible #deckWorkspace #jpDualCommanderHost{
    display:grid!important
  }

  .jp-app-confirm-dialog,.jp-app-prompt-dialog{
    padding:18px!important
  }
  .jp-app-confirm-dialog .create-dialog-actions,
  .jp-app-prompt-dialog .create-dialog-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important
  }
}

@media(max-width:680px){
  /* Three distinct touch layouts on mobile: Stapel, Liste, Karten. */
  .jp-deck-mobile-viewbar{
    grid-template-columns:repeat(3,minmax(0,1fr))!important
  }

  /* Always-visible, compact commander summary. */
  .jp-deck-mobile-commanders[hidden]{display:none!important}
  .jp-deck-mobile-commanders{
    display:grid;
    gap:7px;
    padding:7px 0 2px
  }
  .jp-deck-mobile-commanders.is-single{
    grid-template-columns:minmax(0,1fr)
  }
  .jp-deck-mobile-commanders.is-dual{
    grid-template-columns:repeat(2,minmax(0,1fr))
  }
  .jp-deck-mobile-commander{
    appearance:none;
    display:grid;
    grid-template-columns:54px minmax(0,1fr);
    gap:8px;
    align-items:center;
    min-width:0;
    padding:6px;
    border:1px solid rgba(242,169,59,.22);
    border-radius:11px;
    background:linear-gradient(135deg,rgba(242,169,59,.055),rgba(11,22,35,.82));
    color:var(--text);
    text-align:left
  }
  .jp-deck-mobile-commanders.is-single .jp-deck-mobile-commander{
    grid-template-columns:66px minmax(0,1fr)
  }
  .jp-deck-mobile-commander-image{
    display:block;
    overflow:hidden;
    width:54px;
    aspect-ratio:488/680;
    border-radius:7px;
    background:#08111c
  }
  .jp-deck-mobile-commanders.is-single .jp-deck-mobile-commander-image{
    width:66px
  }
  .jp-deck-mobile-commander-image img{
    display:block;
    width:100%;
    height:100%;
    object-fit:cover
  }
  .jp-deck-mobile-commander-image>span{
    display:grid;
    place-items:center;
    width:100%;
    height:100%;
    color:var(--muted);
    font-size:.52rem
  }
  .jp-deck-mobile-commander-copy{
    display:grid;
    gap:2px;
    min-width:0
  }
  .jp-deck-mobile-commander-copy small{
    color:#8edcff;
    font-size:.55rem;
    font-weight:850;
    letter-spacing:.08em;
    text-transform:uppercase
  }
  .jp-deck-mobile-commander-copy strong{
    overflow:hidden;
    font-size:.7rem;
    line-height:1.15;
    text-overflow:ellipsis;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2
  }

  /* Compact possession/planning block. */
  .jp-deck-mobile-ownership:empty{display:none!important}
  .jp-deck-mobile-ownership{
    padding-top:5px
  }
  .jp-deck-mobile-ownership .deck-ownership-dashboard{
    display:flex!important;
    flex-direction:column!important;
    gap:0!important;
    max-width:none!important;
    margin:0!important;
    padding:9px 10px!important;
    border-radius:11px!important;
    background:rgba(7,12,18,.28)!important
  }
  .jp-deck-mobile-ownership .deck-ownership-dashboard-head{
    display:contents!important
  }
  .jp-deck-mobile-ownership .deck-ownership-dashboard-head>strong{
    order:1;
    margin:0 0 5px;
    font-size:.76rem!important
  }
  .jp-deck-mobile-ownership .deck-ownership-dashboard-head>[data-ownership-refresh]{
    order:4;
    width:100%;
    min-height:34px;
    margin-top:6px!important
  }
  .jp-deck-mobile-ownership .deck-ownership-metrics{
    order:2;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:0!important;
    border-top:1px solid rgba(255,255,255,.07)
  }
  .jp-deck-mobile-ownership .deck-ownership-metrics>button,
  .jp-deck-mobile-ownership .deck-ownership-metrics>div{
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:10px!important;
    min-height:30px!important;
    padding:5px 1px!important;
    border:0!important;
    border-bottom:1px solid rgba(255,255,255,.07)!important;
    border-radius:0!important;
    background:transparent!important
  }
  .jp-deck-mobile-ownership .deck-ownership-metrics span{
    font-size:.67rem!important
  }
  .jp-deck-mobile-ownership .deck-ownership-metrics strong{
    font-size:.75rem!important
  }
  .jp-deck-mobile-ownership .deck-ownership-actions{
    display:contents!important
  }
  .jp-deck-mobile-ownership [data-ownership-allocate]{
    order:3;
    width:100%;
    min-height:36px;
    margin-top:7px!important
  }
  .jp-deck-mobile-ownership .deck-ownership-note{
    display:none!important
  }

  /* Full commander/settings remain available from the menu, but do not occupy
     the normal deck flow. */
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace .commander-selected-card,
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace .commander-picker,
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace #jpDualCommanderHost{
    display:none!important
  }
}

@media(max-width:680px){
  /* Only the layout switcher stays pinned. The deck title, commander summary and
     possession block scroll away normally. */
  #jpDeckMobileHeader{
    position:relative!important;
    top:auto!important;
    z-index:20!important;
    margin:-15px -15px 0!important;
    padding:8px 10px 7px!important;
    border-bottom:0!important;
    box-shadow:none!important;
    background:linear-gradient(180deg,rgba(7,13,22,.98),rgba(7,13,22,.92))!important;
    backdrop-filter:none!important
  }
  #jpDeckMobileViewbar{
    position:sticky!important;
    top:0!important;
    z-index:540!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px!important;
    margin:0 -15px 9px!important;
    padding:7px 10px 8px!important;
    border-top:1px solid rgba(139,220,255,.08);
    border-bottom:1px solid rgba(139,220,255,.16);
    background:rgba(7,13,22,.965)!important;
    box-shadow:0 7px 16px rgba(0,0,0,.22);
    backdrop-filter:blur(16px)
  }
  #jpDeckMobileViewbar button{
    appearance:none;
    min-width:0;
    min-height:36px;
    padding:6px 4px;
    border:1px solid var(--line-soft);
    border-radius:10px;
    background:#0b1623;
    color:#91a6bd;
    font:inherit;
    font-size:.68rem;
    font-weight:850;
    white-space:nowrap
  }
  #jpDeckMobileViewbar button.active{
    border-color:rgba(56,189,248,.48);
    background:rgba(56,189,248,.13);
    color:#e5f9ff;
    box-shadow:inset 0 0 0 1px rgba(56,189,248,.06)
  }

  #jpDeckMobileHeader .jp-library-mobile-menu{
    top:52px!important
  }

  /* Commander summary now carries the deck state and edit actions. */
  #jpDeckMobileHeader .jp-deck-mobile-commanders{
    display:grid;
    gap:8px;
    margin-top:7px;
    padding:9px;
    border:1px solid rgba(242,169,59,.23);
    border-radius:13px;
    background:linear-gradient(135deg,rgba(242,169,59,.055),rgba(11,22,35,.72))
  }
  #jpDeckMobileHeader .jp-deck-mobile-summary-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px
  }
  #jpDeckMobileHeader .jp-deck-mobile-summary-head>div:first-child{
    display:grid;
    gap:2px;
    min-width:0
  }
  #jpDeckMobileHeader .jp-deck-mobile-summary-head .eyebrow{
    font-size:.56rem
  }
  #jpDeckMobileHeader .jp-deck-mobile-summary-head strong{
    overflow:hidden;
    font-size:.78rem;
    line-height:1.15;
    text-overflow:ellipsis;
    white-space:nowrap
  }
  #jpDeckMobileHeader .jp-deck-mobile-summary-badges{
    display:flex;
    flex-wrap:wrap;
    justify-content:flex-end;
    gap:4px
  }
  #jpDeckMobileHeader .jp-deck-mobile-summary-badges span{
    padding:3px 6px;
    border:1px solid rgba(139,220,255,.16);
    border-radius:999px;
    background:rgba(9,18,30,.82);
    color:#9eb3c8;
    font-size:.55rem;
    font-weight:800;
    white-space:nowrap
  }

  #jpDeckMobileHeader .jp-deck-mobile-commander-grid{
    display:grid;
    grid-template-columns:1fr;
    gap:6px
  }
  #jpDeckMobileHeader .jp-deck-mobile-commanders.is-dual .jp-deck-mobile-commander-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander{
    display:grid;
    grid-template-columns:50px minmax(0,1fr);
    gap:7px;
    align-items:center;
    min-width:0;
    padding:5px;
    border:1px solid rgba(255,255,255,.07);
    border-radius:9px;
    background:rgba(7,14,23,.48)
  }
  #jpDeckMobileHeader .jp-deck-mobile-commanders.is-dual .jp-deck-mobile-commander{
    grid-template-columns:42px minmax(0,1fr)
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-image{
    width:50px;
    aspect-ratio:488/680;
    border-radius:6px;
    overflow:hidden;
    background:#07101a
  }
  #jpDeckMobileHeader .jp-deck-mobile-commanders.is-dual .jp-deck-mobile-commander-image{
    width:42px
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-image img{
    display:block;
    width:100%;
    height:100%;
    object-fit:cover
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-copy{
    display:grid;
    gap:2px;
    min-width:0
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-copy small{
    color:#8edcff;
    font-size:.5rem;
    font-weight:850;
    letter-spacing:.06em;
    text-transform:uppercase
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-copy strong{
    overflow:hidden;
    font-size:.64rem;
    line-height:1.14;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-actions:has(> :only-child){
    grid-template-columns:1fr
  }
  #jpDeckMobileHeader .jp-deck-mobile-commander-actions .btn{
    width:100%;
    min-height:32px;
    padding:5px 7px;
    font-size:.62rem
  }

  /* Possession stays above the sticky layout switcher and scrolls away with the
     rest of the deck summary. */
  #jpDeckMobileHeader .jp-deck-mobile-ownership{
    padding-top:8px
  }

  /* The original desktop commander blocks are editor surfaces only. They are
     never duplicated in the normal mobile flow. */
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace .commander-selected-card,
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace .commander-picker,
  body.jp-deck-detail-open:not(.jp-deck-mobile-settings-visible) #deckWorkspace #jpDualCommanderHost{
    display:none!important
  }
}

@media(max-width:680px){
  body.jp-deck-detail-open.jp-deck-mobile-settings-visible.jp-edit-primary-commander #deckWorkspace #jpDualCommanderHost{
    display:none!important
  }
  body.jp-deck-detail-open.jp-deck-mobile-settings-visible.jp-edit-partner-commander #deckWorkspace .commander-selected-card,
  body.jp-deck-detail-open.jp-deck-mobile-settings-visible.jp-edit-partner-commander #deckWorkspace .commander-picker{
    display:none!important
  }
  body.jp-deck-detail-open.jp-deck-mobile-settings-visible.jp-edit-partner-commander #deckWorkspace #jpDualCommanderHost{
    display:grid!important
  }
}

@media(max-width:680px){
  /* Mobile deck detail has one renderer only. The desktop/base list is kept in
     the DOM for editing logic, but never competes with the touch layout. */
  body.jp-deck-detail-open #deckWorkspace>.deck-list-section,
  body.jp-deck-detail-open #deckWorkspace>.deck-enhanced-layout,
  body.jp-deck-detail-open #deckWorkspace>.deck-workspace-head,
  body.jp-deck-detail-open #deckWorkspace>.deck-mode-grid{
    display:none!important
  }

  #jpMobileDeckLayoutBody{
    display:block!important;
    min-width:0;
    margin:0;
    padding:0 0 96px
  }

  #jpMobileDeckLayoutBody .deck-preview-layout{
    grid-template-columns:1fr!important
  }
  #jpMobileDeckLayoutBody .deck-preview-pane,
  #jpMobileDeckLayoutBody .deck-floating-preview{
    display:none!important
  }

  #jpMobileDeckLayoutBody [data-layout-deck-card]{
    -webkit-user-select:none;
    user-select:none;
    -webkit-tap-highlight-color:transparent;
    touch-action:manipulation
  }

  #jpMobileDeckLayoutBody .deck-card-stack{
    --jp-stack-step:20px;
    min-height:0!important;
    height:calc(var(--jp-mobile-stack-card-height,150px) + (var(--stack-count) - 1)*var(--jp-stack-step))!important;
    transition:height .2s ease
  }
  #jpMobileDeckLayoutBody .deck-card-stack.has-mobile-reveal{
    height:calc(var(--jp-mobile-stack-card-height,150px) + var(--jp-mobile-stack-card-height,150px) + (var(--stack-count) - 2)*var(--jp-stack-step))!important
  }
  #jpMobileDeckLayoutBody .deck-stack-card{
    top:calc(var(--stack-index)*var(--jp-stack-step))!important;
    transition:transform .2s ease,box-shadow .2s ease!important
  }
  #jpMobileDeckLayoutBody .deck-stack-card.is-mobile-revealed~.deck-stack-card{
    transform:translateY(calc(var(--jp-mobile-stack-card-height,150px) - var(--jp-stack-step)))!important
  }

  /* The commander summary must always occupy its own visible block. */
  #jpDeckMobileHeader [data-jp-mobile-commanders]{
    display:grid!important
  }
  #jpDeckMobileHeader [data-jp-mobile-commanders][hidden]{
    display:grid!important
  }

  /* Only the view selector stays sticky while the summary scrolls away. */
  #jpDeckMobileHeader{
    position:relative!important;
    top:auto!important
  }
  #jpDeckMobileViewbar{
    position:sticky!important;
    top:0!important;
    z-index:540!important
  }
}

@media(max-width:680px){
  /* When the three-dot menu is open it must sit above the sticky view tabs. */
  #jpDeckMobileHeader.jp-menu-open{
    z-index:900!important;
    overflow:visible!important
  }
  #jpDeckMobileHeader.jp-menu-open .jp-library-mobile-menu{
    z-index:950!important
  }
  #jpDeckMobileHeader.jp-menu-open + #jpDeckMobileViewbar{
    z-index:500!important
  }

  #jpDeckMobileHeader .jp-deck-mobile-commander{
    appearance:none;
    width:100%;
    border:1px solid rgba(255,255,255,.07);
    color:inherit;
    text-align:left
  }

  .jp-commander-editor-dialog{
    width:min(92vw,560px);
    max-height:min(84vh,760px);
    margin:auto;
    padding:0;
    border:1px solid rgba(139,220,255,.22);
    border-radius:18px;
    background:#0b1420;
    color:var(--text);
    box-shadow:0 24px 80px rgba(0,0,0,.62);
    overflow:hidden
  }
  .jp-commander-editor-dialog::backdrop{
    background:rgba(2,7,13,.78);
    backdrop-filter:blur(4px)
  }
  #jpCommanderEditorContent{
    display:grid;
    gap:12px;
    max-height:min(84vh,760px);
    padding:16px;
    overflow:auto
  }
  .jp-commander-editor-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px
  }
  .jp-commander-editor-head h2{
    margin:4px 0 0;
    font-size:1.3rem
  }
  .jp-commander-editor-close{
    appearance:none;
    flex:0 0 42px;
    width:42px;
    height:42px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#101c2b;
    color:var(--text);
    font-size:1.55rem;
    line-height:1
  }
  .jp-commander-editor-search{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px
  }
  .jp-commander-editor-search input{
    min-width:0;
    min-height:44px;
    border:1px solid var(--line);
    border-radius:11px;
    background:#07111d;
    color:var(--text);
    padding:9px 11px;
    font:inherit
  }
  .jp-commander-editor-message{
    min-height:20px;
    font-size:.75rem
  }
  .jp-commander-editor-results{
    display:grid;
    gap:8px
  }
  .jp-commander-editor-result{
    appearance:none;
    display:grid;
    grid-template-columns:58px minmax(0,1fr);
    gap:10px;
    align-items:center;
    width:100%;
    min-width:0;
    padding:7px;
    border:1px solid var(--line-soft);
    border-radius:12px;
    background:#0e1927;
    color:var(--text);
    text-align:left
  }
  .jp-commander-editor-thumb{
    display:block;
    overflow:hidden;
    width:58px;
    aspect-ratio:488/680;
    border-radius:7px;
    background:#07101a
  }
  .jp-commander-editor-thumb img{
    display:block;
    width:100%;
    height:100%;
    object-fit:cover
  }
  .jp-commander-editor-result-copy{
    display:grid;
    gap:3px;
    min-width:0
  }
  .jp-commander-editor-result-copy strong,
  .jp-commander-editor-result-copy span,
  .jp-commander-editor-result-copy small{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap
  }
  .jp-commander-editor-result-copy span,
  .jp-commander-editor-result-copy small{
    color:var(--muted)
  }
}

@media(max-width:680px){
  .jp-commander-editor-dialog{
    top:max(10px,env(safe-area-inset-top));
    bottom:auto;
    margin:max(10px,env(safe-area-inset-top)) auto 0!important;
    max-height:min(64dvh,620px)!important
  }
  #jpCommanderEditorContent{
    max-height:min(64dvh,620px)!important;
    padding-bottom:max(14px,env(safe-area-inset-bottom))
  }
  .jp-commander-editor-tabs{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:6px
  }
  .jp-commander-editor-tabs button{
    appearance:none;
    min-height:36px;
    border:1px solid var(--line);
    border-radius:10px;
    background:#0d1827;
    color:var(--muted);
    font:inherit;
    font-size:.72rem;
    font-weight:850
  }
  .jp-commander-editor-tabs button.active{
    border-color:rgba(56,189,248,.45);
    background:rgba(56,189,248,.12);
    color:#e8f9ff
  }
  .jp-commander-editor-source{
    display:grid;
    gap:9px;
    min-height:0
  }
  .jp-commander-editor-source[hidden]{display:none!important}
  .jp-commander-owned-filter{
    min-height:42px;
    border:1px solid var(--line);
    border-radius:11px;
    background:#07111d;
    color:var(--text);
    padding:8px 10px;
    font:inherit
  }
  .jp-commander-editor-results{
    max-height:34dvh;
    overflow:auto;
    overscroll-behavior:contain
  }
}

@media(max-width:680px){
  .jp-library-menu-section-label{
    display:block;
    color:var(--muted);
    font-size:.66rem;
    font-weight:800;
    margin:2px 0 5px
  }
  .jp-library-menu-choicegrid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:5px;
    margin-bottom:9px
  }
  .jp-library-menu-choicegrid-two{
    grid-template-columns:repeat(2,minmax(0,1fr))
  }
  .jp-library-menu-choicegrid button{
    appearance:none;
    min-height:34px;
    min-width:0;
    padding:5px 6px;
    border:1px solid var(--line-soft);
    border-radius:9px;
    background:#0d1827;
    color:#9db0c4;
    font:inherit;
    font-size:.64rem;
    font-weight:800
  }
  .jp-library-menu-choicegrid button.active{
    border-color:rgba(56,189,248,.44);
    background:rgba(56,189,248,.12);
    color:#e9f9ff
  }

  .jp-mobile-deck-search-dialog{
    display:grid;
    gap:10px
  }
  .jp-mobile-deck-searchbar{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:7px
  }
  .jp-mobile-deck-searchbar input{
    min-width:0;
    min-height:42px;
    border:1px solid var(--line);
    border-radius:11px;
    background:#07111d;
    color:var(--text);
    padding:8px 10px;
    font:inherit
  }
  .jp-mobile-deck-search-results{
    display:grid;
    gap:7px;
    max-height:52vh;
    overflow:auto;
    overscroll-behavior:contain
  }
  .jp-mobile-deck-search-result{
    appearance:none;
    display:grid;
    grid-template-columns:52px minmax(0,1fr);
    gap:8px;
    align-items:center;
    width:100%;
    min-width:0;
    padding:6px;
    border:1px solid var(--line-soft);
    border-radius:10px;
    background:#0e1927;
    color:var(--text);
    text-align:left
  }
  .jp-mobile-deck-search-thumb{
    display:block;
    overflow:hidden;
    width:52px;
    aspect-ratio:488/680;
    border-radius:6px;
    background:#07101a
  }
  .jp-mobile-deck-search-thumb img{
    display:block;
    width:100%;
    height:100%;
    object-fit:cover
  }
  .jp-mobile-deck-search-result>span:last-child{
    display:grid;
    gap:2px;
    min-width:0
  }
  .jp-mobile-deck-search-result strong,
  .jp-mobile-deck-search-result small{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap
  }
  .jp-mobile-deck-search-result small{
    color:var(--muted)
  }
}

@media(max-width:680px){
  .jp-mobile-role-manager{
    display:grid;
    gap:10px
  }
  .jp-mobile-role-list{
    display:grid;
    gap:7px
  }
  .jp-mobile-role-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    min-height:50px;
    padding:8px 9px;
    border:1px solid var(--line-soft);
    border-radius:10px;
    background:#0e1927
  }
  .jp-mobile-role-row>div{
    display:grid;
    gap:2px;
    min-width:0
  }
  .jp-mobile-role-row strong{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap
  }
  .jp-mobile-role-row span{
    color:var(--muted);
    font-size:.7rem
  }
  .jp-mobile-role-reserved{
    display:inline-flex;
    align-items:center;
    min-height:28px;
    padding:4px 7px;
    border:1px solid var(--line-soft);
    border-radius:999px;
    white-space:nowrap
  }
  .jp-mobile-role-delete-confirm p{
    line-height:1.5
  }
}
