/* =================================================
   AVERY BUNCH OS · Mobile layout (≤900px)
   Hides all desktop chrome and renders a scrollable
   home screen with Frequent Flyers + category tiles.
   ================================================= */

/* Hidden by default on desktop */
#mobile-home   { display: none; }
#mob-tunes-bar { display: none; }

@media (max-width: 900px) {

  /* ── Wallpaper → simple CSS dithered pattern ──
     !important overrides all body[data-wp="..."] selectors in desktop.css
     (none of those rules use !important, so this wins unconditionally). */
  .desktop {
    background:
      repeating-conic-gradient(#0d0c22 0% 25%, #07060f 0% 50%)
      0 0 / 6px 6px !important;
  }

  /* ── Desktop chrome: hide it all ── */
  .taskbar       { display: none !important; }
  .windows       { display: none !important; }
  #tunes         { display: none !important; }
  .desktop-icons { display: none !important; }
  .desktop-logo  { display: none !important; }
  .desk-search   { display: none !important; }
  .start-menu    { display: none !important; }
  .ctx           { display: none !important; }

  /* ── Mobile home: scrollable overlay over the dithered bg ── */
  #mobile-home {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: 54px; /* above mob-tunes-bar */
    z-index: 5;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent; /* dither pattern from #desktop shows through */
    -webkit-overflow-scrolling: touch;
  }

  /* ── Mobile header ── */
  .mob-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ink);
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
  }
  .mob-logo {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    flex-shrink: 0;
  }
  .mob-wordmark {
    flex: 1;
    min-width: 0;
  }
  .mob-wm-main {
    font-family: 'Geologica', sans-serif;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mob-wm-sub {
    font-size: 8.5px;
    letter-spacing: 1.5px;
    opacity: 0.45;
    margin-top: 1px;
  }
  .mob-icon-btn {
    background: none;
    border: 2px solid rgba(255,255,255,0.3);
    color: var(--paper);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
    transition: border-color 0.1s;
  }
  .mob-icon-btn:active {
    border-color: var(--accent);
    color: var(--accent);
  }

  /* ── Scrollable body ── */
  .mob-scroll {
    flex: 1;
    padding: 16px 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
  }

  /* ── Section headings ── */
  .mob-section-h {
    font-family: 'Geologica', sans-serif;
    font-weight: 900;
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
  }

  /* ── Frequent Flyers grid ── */
  .mob-flyers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .mob-flyer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px 6px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.14);
    box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
    text-decoration: none;
    color: var(--paper);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-flyer:active {
    background: rgba(255,255,255,0.1);
    border-color: var(--fc, var(--accent));
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  }
  .mob-flyer img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
  }
  .mob-flyer-ico {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fc, var(--accent));
  }
  .mob-flyer-ico svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }
  .mob-flyer .mob-fly-name {
    font-size: 8px;
    letter-spacing: 0.3px;
    opacity: 0.85;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    text-align: center;
  }

  /* ── Category tiles ── */
  .mob-cats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .mob-cat-tile {
    background: var(--ink);
    border: 3px solid var(--cc, var(--accent));
    box-shadow: 4px 4px 0 rgba(0,0,0,0.65);
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 100px;
  }
  .mob-cat-tile:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.65);
  }
  .mct-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }
  .mct-icon img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    display: block;
  }
  .mct-name {
    font-family: 'Geologica', sans-serif;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 1.2px;
    color: var(--cc, var(--accent));
    line-height: 1.2;
  }
  .mct-count {
    font-size: 8.5px;
    letter-spacing: 1px;
    opacity: 0.55;
  }

  /* ── Cat-app: full-screen on mobile (sits above tunes bar) ── */
  .cat-app {
    bottom: 54px !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
  }

  /* ── Search popup: reposition for mobile ── */
  .search-pop {
    bottom: auto !important;
    top: 54px;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
  }

  /* ── Settings window: full-width on mobile ── */
  .settings {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 54px !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
  }
  .settings-body {
    grid-template-columns: 1fr !important;
    overflow: hidden;
  }
  .settings-tabs {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    border-bottom: 2px solid rgba(255,255,255,0.1) !important;
    border-right: none !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  .settings-tabs button {
    font-size: 8px !important;
    padding: 6px 8px !important;
    white-space: nowrap;
  }

  /* ── Mobile tunes mini-bar ── */
  #mob-tunes-bar {
    display: flex !important;
    align-items: center;
    gap: 8px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: var(--ink);
    border-top: 2px solid var(--primary);
    padding: 0 10px;
    z-index: 80;
    flex-shrink: 0;
  }
  .mtb-art {
    width: 38px;
    height: 38px;
    background: rgba(22, 224, 224, 0.08);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
    font-family: serif;
  }
  .mtb-info {
    flex: 1;
    min-width: 0;
  }
  .mtb-track {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--paper);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mtb-sub {
    font-size: 8.5px;
    letter-spacing: 0.6px;
    opacity: 0.5;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mtb-btn {
    background: none;
    border: 2px solid rgba(255,255,255,0.2);
    color: var(--paper);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mtb-btn:active {
    background: rgba(255,255,255,0.1);
    border-color: var(--primary);
  }
  .mtb-btn.mtb-play {
    border-color: var(--primary);
    color: var(--primary);
    width: 38px;
    height: 38px;
    font-size: 14px;
  }
  .mtb-btn.mtb-play:active {
    background: rgba(22, 224, 224, 0.15);
  }

}
