/* ===== App shell layout & responsive scaffolding ===== */
.shell {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "sidebar main"
    "playerbar playerbar";
  height: 100dvh;
  gap: 8px;
  padding: 8px 8px 0 8px;
  background: var(--bg-base-solid);
}
@media (min-width: 900px) {
  .shell { grid-template-columns: auto 1fr; }
}

.sidebar { grid-area: sidebar; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nav-pane, .lib-pane { background: var(--bg-base); border-radius: var(--radius-lg); }
.main-area {
  grid-area: main;
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
}

/* Top bar */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--gutter-x);
  transition: background-color var(--dur-med) ease;
}
.topbar.scrolled-solid { background: rgba(18,18,18,.97); }
.tb-left { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }
.tb-arrows { display: flex; gap: 6px; }
.nav-arrow {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,.7); color: var(--text-bright-accent);
}
.nav-arrow:hover:not(:disabled) { transform: scale(1.06); background: #000; color: #fff; }
.nav-arrow:disabled { color: hsla(0,0%,100%,.3); cursor: default; }

/* contextual search field inside topbar (search view only) */
.tb-searchbox {
  display: none; align-items: center; gap: 10px;
  background: #242424; border-radius: var(--radius-pill);
  padding: 8px 14px; width: min(420px, 42vw); min-width: 220px;
  color: var(--text-subdued);
}
.tb-searchbox.on { display: flex; }
.tb-search-input { flex: 1; font-size: .95rem; min-width: 0; }

.tb-stash { position: relative; flex: 1; min-width: 0; height: 28px; }
.stash-title {
  position: absolute; left: 2px; top: -4px;
  font-size: 1.35rem; font-weight: 700; letter-spacing: -.03em;
  opacity: 0; pointer-events: none; white-space: nowrap; overflow: hidden; max-width: 46vw;
}
.stash-title.on { opacity: 1; transition: opacity var(--dur-med) ease; pointer-events: auto; }
.stash-title a:hover { text-decoration: underline; }

.tb-right { display: flex; align-items: center; gap: 10px; }
.premium-pill {
  background: #fff; color: #000; font-weight: 700; font-size: .82rem;
  border-radius: var(--radius-pill); padding: 9px 16px;
}
.premium-pill:hover { transform: scale(1.04); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #19a34a; color:#000; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}
.avatar:hover { transform: scale(1.05); }

/* View host */
.view-host { flex: 1; position: relative; z-index: 1; overscroll-behavior: contain; scroll-behavior: smooth; }
.view { padding-bottom: 40px; view-transition-name: none; }
.view-anim > .view { padding: calc(var(--topbar-h)) var(--gutter-x) 40px; }

/* Player bar area */
.playerbar { grid-area: playerbar; }

/* Queue panel drawer */
.queue-panel {
  position: fixed; right: 8px; top: 8px; bottom: calc(var(--np-bar-h) + 16px);
  width: min(360px, 92vw);
  background: var(--bg-base);
  border-radius: var(--radius-lg);
  z-index: 40;
  animation: panelIn var(--dur-med) var(--ease-momentum) both;
  overflow: hidden;
  box-shadow: 0 8px 36px rgba(0,0,0,.5);
}
@keyframes panelIn { from { opacity: 0; transform: translateX(24px);} to { opacity: 1; transform: none;} }
.queue-panel-inner { height: 100%; overflow-y: auto; }

/* ------------ responsive: intermediate ------------- */
@media (max-width: 1080px) {
  .shell .lib-pane { display: none !important; }   /* library collapses out */
}
@media (max-width: 900px) {
  .premium-pill { display: none; }
}

/* ------------ mobile chrome takeover ------------- */
.mobile-chrome { display: none; }
@media (max-width: 820px) {
  body { overflow: hidden; }
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "playerbar";
    padding: 0;
    gap: 0;
    height: 100dvh;
  }
  .shell .sidebar { display: none !important; }
  .topbar .tb-searchbox.on { width: min(100%, 72vw); }
  .shell .queue-panel { display: none !important; }  /* queue becomes a page on mobile */
  .shell .playerbar { display: none !important; }

  .mobile-chrome { display: block; position: fixed; inset: auto 0 0 0; z-index: 60; }
  .tab-bar {
    display: flex; justify-content: space-around;
    background: #000; padding: 10px 4px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-soft);
  }
  .tab-item {
    display: grid; place-items: center; gap: 4px;
    color: var(--text-subdued); font-size: .62rem; font-weight: 600;
    min-width: 64px; min-height: 44px;
  }
  .tab-item.active { color: #fff; }

  /* mini player above tabs */
  .mini-player {
    display: flex; align-items: center; gap: 10px;
    margin: 0 6px; margin-bottom: 6px;
    background: var(--bg-card-hover);
    border-radius: 6px; padding: 6px 10px 6px 6px;
    text-align: left; width: calc(100% - 12px); position: relative;
    overflow: hidden;
  }
  .mini-art { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
  .mini-texts { flex: 1; min-width: 0; }
  .mini-title { font-size: .84rem; font-weight: 600; }
  .mini-artists { font-size: .72rem; }
  .mini-progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 0%; background: var(--green); }
  body:not(.has-track) .mini-player { visibility: hidden; }

  .play-btn.small {
    width: 34px; height: 34px; flex: none;
  }

  /* now playing sheet */
  .np-sheet {
    position: fixed; inset: 0; z-index: 80;
    transform: translateY(102%);
    transition: transform var(--dur-slow) var(--ease-momentum);
    background: #121212;
  }
  .np-sheet.on { transform: translateY(0); }
  .sheet-bg { position: absolute; inset: 0; opacity: .85; }
  .sheet-inner { position: relative; height: 100dvh; display: flex; flex-direction: column; padding: 16px; }
  .sheet-topbar { display: flex; align-items: center; justify-content: space-between; }
  .sheet-topbar .center-kick { letter-spacing: .22em; font-size: .6rem; }
  .sheet-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
  .sheet-art {
    width: min(78vw, 320px); aspect-ratio: 1; object-fit: cover;
    border-radius: 8px; align-self: center; box-shadow: 0 14px 44px rgba(0,0,0,.55);
  }
  .sheet-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
  .sheet-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
  .times-row { display: flex; justify-content: space-between; font-size: .68rem; }
  .sheet-controls { display: grid; grid-template-columns: repeat(5, auto); align-items: center; justify-content: space-between; }
}

.circle-btn.ghost {
  color: var(--text-subdued);
  background: rgba(20,20,20,.35);
  backdrop-filter: blur(6px);
}
