
/* ── Base (desktop default: hide phone-only elements) ─────── */

#headerMenuBtn          { display: none; }
.db-phone-title         { display: none; }
.remote-action-more     { display: none; }
.phone-footer           { display: none; }
.phone-panel-title      { display: none; }
.sc-header__brand-panel { display: none; }

/* db-header-actions: always displayed (adapts per breakpoint) */
.db-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Sheet elements: hidden on desktop, animated on phone */
.remote-sheet-backdrop,
.remote-sheet           { display: none; }

/* ── Phone footer base — defined in mobile-app.css (injected globally) ───── */
/*    display: none / flex toggling only below.                               */


/* ============================================================
   @media (max-width: 480px)
   ============================================================ */

@media (max-width: 480px) {

  /* ── Header — liquid glass fixed bar ──────────────────────── */

  .sc-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 210;
    padding: env(safe-area-inset-top, 0px) 4px 0;
    height: calc(52px + env(safe-area-inset-top, 0px));
    background: transparent;
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 0.5px solid rgba(201, 199, 179, 0.08);
    display: flex;
    align-items: flex-end;
  }

  .sc-header__inner {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
    height: 52px;
  }

  /* Phone title — center of header bar */
  .db-phone-title {
    display: block;
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: rgba(201, 199, 179, 0.90);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
    pointer-events: none;
  }

  /* Header actions (bell + avatar) — right side */
  .db-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding-right: 4px;
  }

  .db-header-actions .header-notification-bell,
  .db-header-actions .header-account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(201, 199, 179, 0.06);
    border: 0.5px solid rgba(201, 199, 179, 0.10);
    color: rgba(201, 199, 179, 0.75);
    text-decoration: none;
    flex-shrink: 0;
    position: relative;
    transition: background 120ms ease;
  }

  .db-header-actions .header-notification-bell:active,
  .db-header-actions .header-account-avatar:active {
    background: rgba(201, 199, 179, 0.14);
  }

  .db-header-actions .header-account-avatar img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  .db-header-actions .header-account-avatar__placeholder {
    font-size: 12px;
    font-weight: 600;
    color: rgba(201, 199, 179, 0.65);
  }

  .db-header-actions .header-notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    background: #c50000;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }

  /* Dropdown panel — native Apple floating card */
  .sc-header__items-panel {
    display: flex;
    position: fixed;
    top: calc(52px + env(safe-area-inset-top, 0px) + 8px);
    left: 12px;
    right: 12px;
    bottom: auto;
    max-height: calc(100dvh - 52px - env(safe-area-inset-top, 0px) - 90px - env(safe-area-inset-bottom, 0px));
    z-index: 200;
    flex-direction: column;
    align-items: stretch;
    padding: 4px;
    gap: 0;
    overflow-y: auto;
    background: rgba(12, 8, 8, 0.94);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    backdrop-filter: blur(28px) saturate(1.4);
    border: 0.5px solid rgba(201, 199, 179, 0.10);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    width: auto;
    /* closed state */
    visibility: hidden;
    opacity: 0;
    transform: scale(0.92) translateY(-8px);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease, visibility 0ms linear 180ms;
  }

  body.phone-header-open .sc-header__items-panel {
    visibility: visible;
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    transition: opacity 180ms ease, transform 180ms ease, visibility 0ms linear 0ms;
  }

  /* Offset main content below fixed header */
  body > main {
    padding-top: calc(52px + env(safe-area-inset-top, 0px));
  }

  /* Hamburger button */
  #headerMenuBtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(201, 199, 179, 0.75);
  }

  #headerMenuBtn .hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 200ms ease, opacity 200ms ease;
  }

  body.phone-header-open #headerMenuBtn .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.phone-header-open #headerMenuBtn .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  body.phone-header-open #headerMenuBtn .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Native list rows in floating card dropdown */
  .sc-header__items-panel > .header-link,
  .sc-header__items-panel > button,
  .sc-header__items-panel .admin-nav-links a {
    width: 100%;
    justify-content: flex-start;
    font-size: 16px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    padding: 14px 16px;
    border-radius: 0;
    min-height: 52px;
    color: rgba(201, 199, 179, 0.88);
    background: transparent;
    border-bottom: 0.5px solid rgba(201, 199, 179, 0.08);
  }

  .sc-header__items-panel > .header-link:first-child,
  .sc-header__items-panel > button:first-child {
    border-radius: 12px 12px 0 0;
  }

  .sc-header__items-panel > .header-link:last-child,
  .sc-header__items-panel > button:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
  }

  .sc-header__items-panel > .header-link:active,
  .sc-header__items-panel > button:active,
  .sc-header__items-panel .admin-nav-links a:active {
    background: rgba(201, 199, 179, 0.07);
  }

  .sc-header__items-panel > button.danger {
    color: #ff453a;
  }

  /* ── Playlists card — strip chrome ─────────────────────────── */

  .playlists-panel.card {
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    padding: 0;
    gap: 0;
  }

  .playlists-panel.card > .dashboard-panel-tabs,
  .dashboard-panel-tabs {
    display: none;
  }

  /* Hide logo and big title — header bar title takes over */
  .dashboard-panel-logo { display: none !important; }
  .phone-panel-title    { display: none !important; }
  .dashboard-panel-heading { padding: 0; }
  .dashboard-panel-subtitle { display: none; }

  /* ── Desktop sidebar + overflow panels hidden ───────────────── */

  .db-sidebar {
    display: none !important;
  }

  #dashboardTransferPanel,
  #dashboardNotificationsPanel,
  #dashboardDocumentationPanel,
  #dashboardPricingPanel,
  #dashboardEditorPanel {
    display: none !important;
  }

  /* ── Main grid — push content above footer ─────────────────── */

  .wrap.grid {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    padding-left: 0;
    padding-right: 0;
  }

  /* ── Remote section: edge-to-edge ───────────────────────────── */

  .remote-section {
    padding: 0;
  }

  /* Status pill */
  .remote-section > .row {
    padding: 8px 14px 4px;
  }

  /* ── Wallet card stack — replaces 2-col grid ────────────────── */

  #remotePlaylists.remote-list,
  #libraryTransfers.remote-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 12px 24px;
  }

  /* Card base — collapsed to top-edge peek; expands on focus */
  .remote-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(12, 8, 8, 0.82);
    border: 0.5px solid rgba(201, 199, 179, 0.09);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: border-color 220ms ease, box-shadow 220ms ease,
                max-height 360ms cubic-bezier(0.32, 0.72, 0, 1);
    -webkit-tap-highlight-color: transparent;
    max-height: 64px;
    margin-bottom: 3px;
  }

  /* Cover — full width, top of card */
  .remote-item .remote-right {
    order: -1;
    width: 100%;
    display: block;
    justify-content: unset;
    align-items: unset;
    align-self: unset;
    flex-shrink: 0;
  }

  .remote-item .remote-preview-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    border-radius: 0;
    border: none;
    display: block;
    overflow: hidden;
    background: rgba(201, 199, 179, 0.06);
    transition: opacity 200ms ease;
  }

  /* Cover tap target when focused */
  .remote-item.is-focused .remote-preview-cover {
    cursor: pointer;
  }

  .remote-item.is-focused .remote-preview-cover:active {
    opacity: 0.80;
  }

  /* Info band */
  .remote-item .remote-left {
    order: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
    height: auto;
    min-width: 0;
    gap: 0;
  }

  .remote-item .remote-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: rgba(201, 199, 179, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Meta, preview, actions — hidden in collapsed state */
  .remote-item .remote-meta,
  .remote-item .remote-preview,
  .remote-item .remote-actions {
    visibility: hidden;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 240ms ease, max-height 300ms ease, visibility 0ms linear 240ms;
  }

  /* ── Focused card state ─────────────────────────────────────── */

  .remote-item.is-focused {
    border-color: rgba(197, 0, 0, 0.28);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.70), 0 0 0 1px rgba(197, 0, 0, 0.12);
  }

  .remote-item.is-focused .remote-meta,
  .remote-item.is-focused .remote-preview,
  .remote-item.is-focused .remote-actions {
    visibility: visible;
    opacity: 1;
    max-height: 500px;
    pointer-events: auto;
    transition: opacity 240ms ease, max-height 360ms ease, visibility 0ms linear 0ms;
  }

  .remote-item.is-focused .remote-meta {
    font-size: 12px;
    color: rgba(201, 199, 179, 0.50);
    margin-top: 4px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .remote-item.is-focused .remote-preview {
    font-size: 12px;
    color: rgba(201, 199, 179, 0.40);
    line-height: 1.5;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .remote-item.is-focused .remote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 0.5px solid rgba(201, 199, 179, 0.09);
  }

  /* Action buttons inside focused card */
  .remote-item.is-focused .remote-actions button,
  .remote-item.is-focused .remote-actions .publish-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    border: 0.5px solid rgba(201, 199, 179, 0.14);
    background: rgba(201, 199, 179, 0.07);
    color: rgba(201, 199, 179, 0.85);
    cursor: pointer;
    min-height: 0;
    height: auto;
    width: auto;
    text-transform: none;
    letter-spacing: normal;
    transition: background 100ms ease;
  }

  .remote-item.is-focused .remote-actions button:active,
  .remote-item.is-focused .remote-actions .publish-btn:active {
    background: rgba(201, 199, 179, 0.14);
  }

  .remote-item.is-focused .remote-actions .publish-btn--danger,
  .remote-item.is-focused .remote-actions .remote-action-delete {
    color: #ff453a;
    border-color: rgba(255, 69, 58, 0.22);
    background: rgba(255, 69, 58, 0.07);
  }

  /* Copy URL / Open player get accent treatment */
  .remote-item.is-focused .remote-actions .remote-action-copy,
  .remote-item.is-focused .remote-actions .remote-action-open {
    background: rgba(197, 0, 0, 0.14);
    border-color: rgba(197, 0, 0, 0.28);
    color: rgba(255, 120, 100, 0.92);
  }

  .remote-item.is-focused .remote-actions .btn-label {
    font-size: 13px;
    opacity: 1;
    max-width: none;
    display: inline;
  }

  .remote-item.is-focused .remote-actions .icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  /* Overflow-only actions — hidden until more is toggled */
  .remote-item.is-focused .remote-action-delete,
  .remote-item.is-focused .remote-action-scramble,
  .remote-item.is-focused .remote-action-collab-copy,
  .remote-item.is-focused .remote-action-collab-disable,
  .remote-item.is-focused .remote-action-collab-enable,
  .remote-item.is-focused .remote-action-pool-link {
    display: none;
  }

  .remote-item.is-focused .remote-actions.is-more-open .remote-action-delete:not([hidden]),
  .remote-item.is-focused .remote-actions.is-more-open .remote-action-scramble:not([hidden]),
  .remote-item.is-focused .remote-actions.is-more-open .remote-action-collab-copy:not([hidden]),
  .remote-item.is-focused .remote-actions.is-more-open .remote-action-collab-disable:not([hidden]),
  .remote-item.is-focused .remote-actions.is-more-open .remote-action-collab-enable:not([hidden]),
  .remote-item.is-focused .remote-actions.is-more-open .remote-action-pool-link:not([hidden]) {
    display: inline-flex;
  }

  .remote-item.is-focused .remote-action-more {
    display: inline-flex;
  }

  /* ── Bottom sheet ─────────────────────────────────────────── */

  .remote-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 280ms ease, visibility 0ms linear 280ms;
  }

  .remote-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: rgba(12, 8, 8, 0.97);
    -webkit-backdrop-filter: blur(32px) saturate(1.4);
    backdrop-filter: blur(32px) saturate(1.4);
    border-radius: 24px 24px 0 0;
    border-top: 0.5px solid rgba(201, 199, 179, 0.10);
    max-height: 88dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 340ms cubic-bezier(0.32, 0.72, 0, 1),
                visibility 0ms linear 340ms;
  }

  body.remote-sheet-open .remote-sheet-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 280ms ease, visibility 0ms linear 0ms;
  }

  body.remote-sheet-open .remote-sheet {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 340ms cubic-bezier(0.32, 0.72, 0, 1),
                visibility 0ms linear 0ms;
  }

  .remote-sheet__handle-row {
    display: flex;
    justify-content: center;
    padding: 12px 0 6px;
    flex-shrink: 0;
  }

  .remote-sheet__handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(201, 199, 179, 0.22);
  }

  .remote-sheet__header {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    flex-shrink: 0;
  }

  .remote-sheet__cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    overflow: hidden;
    background: rgba(201, 199, 179, 0.06);
  }

  .remote-sheet__cover > * {
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: cover;
  }

  .remote-sheet__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px 8px;
  }

  .remote-sheet__title {
    font-size: 17px;
    font-weight: 600;
    color: rgba(201, 199, 179, 0.92);
    line-height: 1.25;
  }

  .remote-sheet__meta {
    font-size: 13px;
    color: rgba(201, 199, 179, 0.48);
    line-height: 1.3;
  }

  .remote-sheet__preview {
    padding: 0 16px 14px;
    font-size: 12px;
    color: rgba(201, 199, 179, 0.42);
    line-height: 1.5;
    flex-shrink: 0;
  }

  .remote-sheet__actions {
    flex-shrink: 0;
    border-top: 0.5px solid rgba(201, 199, 179, 0.09);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .remote-sheet__actions .remote-actions {
    display: flex;
    flex-direction: column;
  }

  .remote-sheet__actions .remote-actions button {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    border: none;
    border-bottom: 0.5px solid rgba(201, 199, 179, 0.08);
    border-radius: 0;
    background: transparent;
    color: rgba(201, 199, 179, 0.88);
    font-size: 16px;
    font-family: inherit;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
  }

  .remote-sheet__actions .remote-actions button:last-child {
    border-bottom: none;
  }

  .remote-sheet__actions .remote-actions .btn-label {
    opacity: 1;
    max-width: none;
    font-size: 16px;
  }

  .remote-sheet__actions .remote-actions .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.65;
  }

  .remote-sheet__actions .remote-action-delete,
  .remote-sheet__actions .remote-action-scramble,
  .remote-sheet__actions .remote-action-collab-copy,
  .remote-sheet__actions .remote-action-collab-disable,
  .remote-sheet__actions .remote-action-collab-enable,
  .remote-sheet__actions .remote-action-pool-link {
    display: none;
  }

  .remote-sheet__actions .remote-actions.is-more-open .remote-action-delete:not([hidden]),
  .remote-sheet__actions .remote-actions.is-more-open .remote-action-scramble:not([hidden]),
  .remote-sheet__actions .remote-actions.is-more-open .remote-action-collab-copy:not([hidden]),
  .remote-sheet__actions .remote-actions.is-more-open .remote-action-collab-disable:not([hidden]),
  .remote-sheet__actions .remote-actions.is-more-open .remote-action-collab-enable:not([hidden]),
  .remote-sheet__actions .remote-actions.is-more-open .remote-action-pool-link:not([hidden]) {
    display: flex;
  }

  .remote-sheet__actions .remote-action-more {
    display: flex;
  }

  .remote-sheet__actions .remote-action-delete {
    color: #ff453a;
  }

  /* ── Swipe indicator dots ────────────────────────────────────── */

  .db-swipe-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px 0 2px;
  }

  .db-swipe-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(201, 199, 179, 0.20);
    transition: background 200ms ease, transform 200ms ease;
  }

  .db-swipe-dot.is-active {
    background: rgba(201, 199, 179, 0.70);
    transform: scale(1.25);
  }

  /* ── Phone footer — liquid glass, single create button ──────── */

  .phone-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(6, 4, 4, 0.78);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    backdrop-filter: blur(28px) saturate(1.6);
    border-top: 0.5px solid rgba(201, 199, 179, 0.10);
    border-radius: 0;
    /* Override mobile-app.css solid background */
    background: rgba(6, 4, 4, 0.78) !important;
    border-top-color: rgba(201, 199, 179, 0.10) !important;
  }

  .phone-footer__create-anchor {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
  }

  .phone-footer__create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 32px;
    border-radius: 26px;
    background: #c50000;
    color: #fff;
    border: none;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    min-width: 180px;
    transition: background 120ms ease, transform 120ms ease;
    box-shadow: 0 4px 20px rgba(197, 0, 0, 0.38);
  }

  .phone-footer__create-btn:active {
    background: #a30000;
    transform: scale(0.96);
  }

  /* ── Swipe transition on main panels ──────────────────────── */

  #dashboardRemotePanel,
  #dashboardLibraryPanel {
    transition: opacity 200ms ease, transform 200ms ease;
  }
}
