/* ============================================================================
   REPERFORM-MOBILE.CSS — phone-first APP SHELL for the Re-Performance Studio
   ----------------------------------------------------------------------------
   Loaded after reperform.css. EVERY rule lives inside @media (max-width: 720px),
   so the desktop studio is byte-for-byte unchanged. On phones the free-choice
   Re-Performance Studio becomes a clean app shell that matches the approved
   mobile mock (design/reperform-mobile):

     • a top app bar (back · module name · "Step N of M" · info · menu)
     • a slim module rail (the 5 modules as tappable icon chips)
     • a slim step rail for the active module
     • a card-based single-column body
     • a bottom thumb-zone dock (ghost back · cyan primary action)
     • the long module copy tucked behind the app-bar ⓘ (progressive disclosure)

   No engine behaviour changes: the 5 modules, the tab switcher (setModule), the
   Pro gates, the DAW / recorder / live-instrument widget and the fidelity gate +
   AI-likeness meter are all untouched. The app bar / rails / dock are created by
   reperform-mobile.js at phone widths only; the in-body primary CTA is hidden on
   phones and mirrored by the dock (the dock button simply clicks the real one).
   ============================================================================ */

/* The app bar / step rail / dock are created by reperform-mobile.js; hide them
   on desktop (and keep the page inert if the window is widened). */
.rp-appbar { display: none; }
.rp-steprail { display: none; }
.rp-dock { display: none; }
.rp-shell-head { display: contents; }

@media (max-width: 720px) {

  /* ------------------------------------------------------------------ *
     0. Kill the marketing chrome — the mock is a pure app shell
     ------------------------------------------------------------------ */
  body.rp-on .site-nav,
  body.rp-on .account-bar,
  body.rp-on .app-header,
  body.rp-on .rp-choose,
  body.rp-on .app-footer { display: none !important; }

  body.rp-on .wrap { max-width: none; padding: 0; }

  /* ------------------------------------------------------------------ *
     0b. Menu drawer — the app bar's ☰ reveals the site navigation
         (the mock has no nav; we keep it reachable so nothing is lost)
     ------------------------------------------------------------------ */
  body.rp-on.rp-nav-open { overflow: hidden; }
  body.rp-on.rp-nav-open .site-nav {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(6, 8, 11, 0.66);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-bottom: none;
  }
  body.rp-on.rp-nav-open .site-nav .wrap {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(80vw, 320px);
    height: 100%;
    max-width: none;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--panel);
    border-left: 1px solid var(--border);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
    overflow-y: auto;
  }
  body.rp-on.rp-nav-open .site-nav .brand-lockup { margin-bottom: 10px; }
  body.rp-on.rp-nav-open .site-nav .nav-toggle { display: none; }
  body.rp-on.rp-nav-open .site-nav .nav-links {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    margin: 6px 0 12px;
  }
  body.rp-on.rp-nav-open .site-nav .nav-links a {
    width: 100%;
    padding: 12px;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
  }
  body.rp-on.rp-nav-open .site-nav .nav-links a:hover,
  body.rp-on.rp-nav-open .site-nav .nav-links a.active {
    background: var(--panel-2);
    color: var(--accent-2);
  }
  body.rp-on.rp-nav-open .site-nav .nav-cta:not([hidden]) {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  body.rp-on.rp-nav-open .site-nav .nav-cta .nav-user { color: var(--text-dim); font-size: 13px; }

  /* ------------------------------------------------------------------ *
     1. Panel + sticky app-shell header (app bar · module rail · step rail)
     ------------------------------------------------------------------ */
  body.rp-on section.reperform-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 0 150px;   /* room for the fixed dock */
    margin: 0;
  }
  /* The app bar already names the module — drop the duplicated in-body title. */
  body.rp-on section.reperform-panel > h2 { display: none; }

  body.rp-on .rp-shell-head {
    display: block;
    position: sticky;
    top: 0;
    z-index: 40;
    margin: 0 0 12px;
    background: rgba(15, 17, 21, 0.94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 var(--border), 0 12px 30px rgba(0, 0, 0, 0.5);
  }

  /* --- app bar --- */
  body.rp-on .rp-appbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px 9px;
  }
  body.rp-on .rp-ab-back {
    width: 36px; height: 36px; flex: 0 0 auto;
    display: grid; place-items: center;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 11px; color: var(--text); font-size: 17px; line-height: 1;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  body.rp-on .rp-ab-ttl { flex: 1 1 auto; min-width: 0; }
  body.rp-on .rp-ab-ttl b {
    display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  body.rp-on .rp-ab-ttl small { display: block; font-size: 11px; font-weight: 600; color: var(--text-dim); }
  body.rp-on .rp-ab-info {
    width: 36px; height: 36px; flex: 0 0 auto;
    display: grid; place-items: center;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 50%; color: var(--accent-2); font-size: 15px; font-weight: 800;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  body.rp-on .rp-ab-info.open {
    background: rgba(53, 194, 255, 0.14);
    border-color: rgba(53, 194, 255, 0.5);
  }
  body.rp-on .rp-ab-menu {
    width: 36px; height: 36px; flex: 0 0 auto;
    display: grid; place-items: center;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 11px; color: var(--text); font-size: 15px; line-height: 1;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  body.rp-on .rp-ab-menu[aria-expanded="true"] {
    background: rgba(53, 194, 255, 0.14);
    border-color: rgba(53, 194, 255, 0.5);
    color: var(--accent-2);
  }

  /* --- module rail (the 5 modules as EQUAL-WIDTH icon chips) --- */
  body.rp-on .rp-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0;
    padding: 2px 12px 12px;
    border-bottom: none;
    overflow: hidden;
  }
  body.rp-on .rp-tab {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 4px;
    border-radius: 12px;
    text-align: center;
  }
  body.rp-on .rp-tab-ico { font-size: 20px; line-height: 1; }
  body.rp-on .rp-tab-txt { align-items: center; gap: 0; min-width: 0; max-width: 100%; }
  body.rp-on .rp-tab-txt b {
    font-size: 9px; font-weight: 800; letter-spacing: .02em;
    text-transform: uppercase; line-height: 1.1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  body.rp-on .rp-tab-txt small { display: none; }
  body.rp-on .rp-tab .rp-pro-badge { display: none; }

  /* --- step rail --- */
  body.rp-on .rp-steprail {
    display: grid;
    gap: 5px;
    padding: 0 14px 12px;
  }
  body.rp-on .rp-seg {
    height: 5px;
    border-radius: 999px;
    background: #1c212b;
    transition: background 0.2s ease, box-shadow 0.2s ease;
  }
  body.rp-on .rp-seg.done { background: linear-gradient(90deg, var(--accent-2), var(--accent-3)); }
  body.rp-on .rp-seg.active {
    background: linear-gradient(90deg, var(--accent), #ffb37a);
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
  }

  /* ------------------------------------------------------------------ *
     2. Card-based single-column body
     ------------------------------------------------------------------ */
  body.rp-on #rp-module-instrumental,
  body.rp-on #rp-module-vocal,
  body.rp-on #rp-module-singalong,
  body.rp-on #rp-module-liveinstrument,
  body.rp-on #rp-module-likeness { padding: 0 14px; }

  body.rp-on .rp-section {
    margin-top: 12px;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 15px;
  }
  body.rp-on .rp-section > h4 { margin: 0 0 10px; font-size: 13px; }
  /* nested sections (AUTO / CUSTOM) must not double-card */
  body.rp-on .rp-section .rp-section {
    margin-top: 10px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
  }

  /* ------------------------------------------------------------------ *
     3. Progressive disclosure — the long module copy collapses behind ⓘ
     ------------------------------------------------------------------ */
  body.rp-on .rp-tagline { display: none; }
  body.rp-on.rp-show-info .rp-tagline {
    display: block;
    margin: 0 0 4px;
    font-size: 13px;
  }
  body.rp-on .rp-more { margin-top: 12px; }

  /* ------------------------------------------------------------------ *
     4. Result · fidelity gate · AI-likeness meter — mock-style cards
     ------------------------------------------------------------------ */
  body.rp-on .rp-result-card { border-radius: 15px; }
  body.rp-on .rp-fidelity,
  body.rp-on .likeness-meter {
    border-radius: 15px;
    padding: 12px;
    background: var(--panel-2);
  }
  body.rp-on .likeness-meter { margin-top: 12px; }
  body.rp-on .inst-likeness-meter .meter-row { grid-template-columns: 96px 1fr 42px; gap: 9px; }
  body.rp-on .meter-fill.before { background: linear-gradient(90deg, var(--danger), #ffb37a); }
  body.rp-on .meter-fill.after { background: linear-gradient(90deg, var(--accent-2), var(--accent-3)); }
  body.rp-on .rp-fid-checks { grid-template-columns: 1fr 1fr; gap: 6px; }

  /* ------------------------------------------------------------------ *
     5. Thumb-zone dock
     ------------------------------------------------------------------ */
  body.rp-on .rp-dock {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(15, 17, 21, 0), rgba(15, 17, 21, 0.96) 38%);
    border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    z-index: 50;
  }
  body.rp-on .rp-dock-back {
    flex: 0 0 54px;
    min-height: 50px;
    display: grid; place-items: center;
    border-radius: 15px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 19px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  body.rp-on .rp-dock-primary {
    flex: 1 1 auto;
    min-height: 50px;
    border-radius: 15px;
    font-size: 15px;
    font-weight: 800;
    color: #08111c;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    border: none;
    box-shadow: 0 10px 24px rgba(53, 194, 255, 0.3);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  body.rp-on .rp-dock-primary:disabled {
    opacity: 0.4;
    box-shadow: none;
    cursor: not-allowed;
  }

  /* The in-body primary CTA is mirrored by the dock (the dock clicks the real
     one, so its listeners + disabled state are preserved). */
  body.rp-on #rp-btn-start,
  body.rp-on #vr-btn-start,
  body.rp-on #sa-btn-start,
  body.rp-on #lk-btn-start { display: none; }

  /* ------------------------------------------------------------------ *
     6. Mock-style controls
     ------------------------------------------------------------------ */
  body.rp-on .rp-btn { border-radius: 14px; }
  body.rp-on .rp-btn.primary {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    color: #08111c;
    border-color: transparent;
    border-radius: 14px;
    font-weight: 800;
    min-height: 48px;
  }
  body.rp-on .rp-btn.primary:hover:not(:disabled) { filter: brightness(1.06); }

  body.rp-on .rp-dropzone {
    border: 1.5px dashed var(--border);
    border-radius: 18px;
    background: radial-gradient(120% 120% at 50% 0%, rgba(53, 194, 255, 0.08), transparent 70%), var(--panel);
    padding: 24px 16px;
  }
  body.rp-on .rp-dropzone-icon { font-size: 40px; }
  body.rp-on .rp-modes { grid-template-columns: 1fr; gap: 10px; }
  body.rp-on .rp-mode { border-radius: 15px; }
  body.rp-on .rp-select,
  body.rp-on .rp-field input[type="text"] { min-height: 46px; }
  body.rp-on .action-row { flex-direction: column; align-items: stretch; gap: 10px; }
  body.rp-on .action-row > * { width: 100%; }
}

/* Very small phones — tighten a touch more. */
@media (max-width: 380px) {
  body.rp-on .rp-tab { padding: 6px 2px; }
  body.rp-on .rp-tab-txt b { font-size: 8px; }
  body.rp-on .rp-tab-ico { font-size: 18px; }
  body.rp-on .rp-dock-primary { font-size: 14px; }
  body.rp-on .rp-ab-ttl b { font-size: 14px; }
  body.rp-on .rp-fid-checks { grid-template-columns: 1fr; }
}
