/* ==========================================================================================================================================================
   MineFleet on a PHONE (site 1.96.0). The owner's words: it was "impossible" to reach many buttons on a phone -- on a rig's page the whole toolbar (the four tabs, mining, restart,
   shut down, console, miner log, temperature protection, planning, refresh) was squeezed into a window of about 80 px that scrolled sideways, and the top right buttons took the rest.
   "Ne touche pas a la version PC": EVERY rule below sits inside the max-width: 760px block (the same limit as the older phone rules of style.css), except the two lines that HIDE the
   phone-only bits (.tb-label, .logout-ico) for everybody else. Nothing here is read above 760 px. The file is loaded LAST, so at equal weight it wins over the older phone rules; the
   rules start with #app so they also win over the ones written with "body" or with more classes.

   What a phone gets:
     - the top bar is two lines at most: the logo, where you are, and FIVE round buttons that all stay on screen (pool, development, bell, account, log out as an icon);
     - on a rig's page a toolbar of real buttons with their name under the icon, in a grid, no sideways scrolling: the actions, then the four tabs. The tabs stay on screen when the page
       scrolls (the rest of the top bar scrolls away, so the tabs do not eat the screen);
     - the tabs of the sections (Fermes, Wallets, Miners, Flight Sheets, Admin, support) closer together, so they fit;
     - the administrator's sub-tabs with their names (they were eight unnamed icons);
     - bigger lines in the menus that open under a button.
   ========================================================================================================================================================== */

/* the phone-only bits are invisible outside a phone */
.tb-label { display: none; }
.logout-ico { display: none; }

@media (max-width: 760px) {
  #app { --mf-row: 50px; --mf-gap: 6px; --mf-rig-hide: calc(56px + 2 * var(--mf-row) + var(--mf-gap)); }   /* a row of the rig toolbar, the gap between two; what scrolls away of the top bar on a rig's page (the first line 56 + the two rows of actions + the gap between them: the tabs stay, with one gap of air above them) */
  @media (max-width: 380px) { #app { --mf-gap: 4px; } }

  /* ------------------------------------------------------------------ the top bar */
  #app .topbar { flex-wrap: wrap; align-items: center; padding: 0 10px; gap: 0 6px; }
  #app .topbar > .brand { order: 0; min-height: 56px; }
  #app .topbar > .brand .logo { width: 30px; height: 30px; font-size: 15px; }
  #app .topbar > .topbar-middle { order: 1; flex: 1 1 0; min-width: 0; min-height: 56px; padding: 0 4px; justify-content: flex-start; align-items: center; overflow: hidden; }
  #app .topbar > .right { order: 2; margin-left: auto; min-height: 56px; gap: 4px; flex-shrink: 0; }
  #app .topbar .crumbs { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
  #app .topbar .crumbs a { color: var(--text-dim); }

  /* the five buttons of the right: all round / square 38 px, the same size, never pushed off the screen */
  #app .topbar .pool-btn, #app .topbar .roadmap-btn,
  #app .topbar .notif-btn, #app .topbar .account-btn, #app .topbar #btn-logout {
    width: 38px; height: 38px; padding: 0; margin: 0; justify-content: center; border-radius: 10px; flex: 0 0 auto;
  }
  #app .topbar .pool-btn svg, #app .topbar .roadmap-btn svg.roadmap-btn-ico { width: 18px; height: 18px; }
  #app .topbar .notif-btn svg { width: 20px; height: 20px; }
  #app .topbar .account-btn svg { width: 20px; height: 20px; }
  #app .topbar .notif-badge { top: 0; right: -1px; }
  /* "Deconnexion" becomes a door icon (its words stay for a screen reader, out of sight) */
  #app .topbar #btn-logout { background: transparent; border-color: transparent; color: var(--text-dim); }
  #app .topbar #btn-logout .logout-ico { display: block; }
  #app .topbar #btn-logout .logout-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* ------------------------------------------------------------------ a rig's page: the toolbar under the first line */
  #app .topbar > .topbar-middle:has(.rig-toolbar:not(.hidden)) { order: 3; flex: 0 0 100%; min-height: 0; padding: 0 0 8px; overflow: visible; }
  /* only the last row (the four tabs) stays on screen when the page scrolls: a sticky bar whose top is above the screen by the height of what comes before it */
  #app .topbar:has(.rig-toolbar:not(.hidden)) { top: calc(-1 * var(--mf-rig-hide)); }
  #app .rig-toolbar:not(.hidden) { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: var(--mf-row); gap: var(--mf-gap); width: 100%; align-items: stretch; }
  #app .rig-toolbar > .rig-toolbar-sep { display: none; }
  #app .rig-toolbar > .rig-toolbar-group { display: contents; }
  #app .rig-toolbar > .rig-toolbar-group:first-child { display: grid; order: 9; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--mf-gap); }

  #app .rig-toolbar .icon-btn {
    width: 100%; min-width: 0; height: var(--mf-row); padding: 4px 2px 3px; flex-direction: column; justify-content: center; gap: 4px;
    border-radius: 11px; background: var(--bg-card); border: 1px solid var(--border); font-size: 18px; line-height: 1;
  }
  #app .rig-toolbar .icon-btn:hover { background: var(--bg-card); }
  #app .rig-toolbar .icon-btn svg { width: 19px; height: 19px; flex: none; }
  #app .rig-toolbar .icon-btn .icon-btn-emoji { font-size: 18px; line-height: 1; }
  #app .rig-toolbar .icon-btn .tb-label, #app .rig-toolbar .icon-btn .icon-btn-text {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%;
    font-size: 10.5px; font-weight: 600; line-height: 1.1; text-align: center; overflow-wrap: anywhere;
  }
  @media (max-width: 380px) { #app .rig-toolbar .icon-btn { padding-left: 0; padding-right: 0; } #app .rig-toolbar .icon-btn .tb-label, #app .rig-toolbar .icon-btn .icon-btn-text { font-size: 9.5px; letter-spacing: -.1px; overflow-wrap: break-word; } }
  @media (max-width: 340px) { #app .rig-toolbar .icon-btn .tb-label, #app .rig-toolbar .icon-btn .icon-btn-text { font-size: 8.5px; } }
  #app .rig-toolbar .icon-btn.active { color: var(--accent); background: rgba(245,165,36,0.14); border-color: rgba(245,165,36,0.5); }
  #app .rig-toolbar .icon-btn.guard-hot { background: rgba(245,165,36,0.14); }
  #app .rig-toolbar .icon-btn.danger { color: #ff8a96; }
  #app .rig-toolbar .icon-btn-dropdown { min-width: 0; }
  /* the refresh interval (a small select) and the refresh button that sits with it (two columns wide) */
  #app .rig-toolbar .refresh-select { width: 100%; min-width: 0; height: var(--mf-row); padding: 0 2px; border-radius: 11px; font-size: 13px; font-weight: 600; text-align: center; text-align-last: center; background: var(--bg-card); border-color: var(--border); }
  #app .rig-toolbar #btn-refresh-now { grid-column: span 2; flex-direction: row; gap: 8px; }

  /* the cards of the machine (and the totals under them) belong to the OVERVIEW: on the other tabs they pushed the tab's own content some 2000 px down the page (ten cards), so a tap on a tab seemed to do nothing */
  #view-rig:not([data-tab-active="overview"]) #rig-gpu-rows,
  #view-rig:not([data-tab-active="overview"]) #rig-cpu-row,
  #view-rig:not([data-tab-active="overview"]) .gpu-row-hash-total,
  #view-rig:not([data-tab-active="overview"]) .shares-line { display: none; }

  /* ------------------------------------------------------------------ the tabs of the sections (Fermes / Wallets / Miners / Flight Sheets / Admin / support) */
  #app .section-tabs { gap: 0; padding: 0 4px; align-items: stretch; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #app .section-tabs::-webkit-scrollbar { display: none; }
  #app .section-tabs > a { flex: 0 0 auto; padding: 15px 6px; font-size: 13px; }
  #app .section-tabs-right { gap: 0; margin-left: auto; flex: 0 0 auto; }
  #app .section-tabs-right a { padding: 15px 6px; }
  #app .section-tabs .nav-ico { display: none; }   /* the little shield of "Admin": the word is enough on a phone, and the five tabs then fit from 360 px */
  #app .support-btn { width: 36px; height: 36px; padding: 0; justify-content: center; margin-left: 2px; }
  @media (max-width: 380px) { #app .section-tabs > a, #app .section-tabs-right a { padding-left: 5px; padding-right: 5px; font-size: 12.5px; } }   /* 360 px with the Admin tab too */

  /* ------------------------------------------------------------------ the administrator's sub-tabs: a grid of four, each with its name (they were eight icons with no words) */
  #app .admin-subtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; width: auto; padding: 6px; border-radius: 16px; }
  #app .admin-subtabs .icon-btn.labeled {
    width: 100%; min-width: 0; height: 54px; padding: 4px 2px; flex-direction: column; justify-content: center; gap: 3px; border-radius: 12px; font-size: 10.5px; position: relative;
  }
  #app .admin-subtabs .icon-btn.labeled .icon-btn-emoji { font-size: 17px; line-height: 1; }
  #app .admin-subtabs .icon-btn.labeled .icon-btn-text {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; font-size: 10.5px; font-weight: 700; line-height: 1.1; text-align: center;
  }
  #app .admin-subtabs .tab-count { position: absolute; top: 2px; right: 4px; }
  /* the three lists of the Membres tab (site 1.98.0): thumb-sized buttons, side by side */
  #app .admin-members-filters { gap: 8px; }
  #app .admin-members-filters .sugg-filter { min-height: 38px; padding: 0 16px; font-size: 13.5px; }
  @media (max-width: 380px) { #app .admin-subtabs .icon-btn.labeled .icon-btn-text { font-size: 9.5px; overflow-wrap: break-word; } }
  @media (max-width: 340px) { #app .admin-subtabs .icon-btn.labeled .icon-btn-text { font-size: 9px; letter-spacing: -.1px; } }

  /* ------------------------------------------------------------------ the totals told per flight sheet (several cryptos at once): one block per line, instead of a 4-column table that was 480 px wide and made the whole page scroll sideways */
  #app .htg { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; row-gap: 0; margin: 2px 0; }
  #app .htg-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
  #app .htg-row:first-child { border-top: 0; }
  #app .htg-name { grid-column: 1 / -1; font-weight: 700; color: var(--text); }
  #app .htg-hash, #app .htg-eff, #app .htg-conso { white-space: normal; font-size: 12px; }

  /* ------------------------------------------------------------------ the activity pills of a rig ("Redemarrage du minage demande ... il y a 2 min  x"): they wrap instead of running 475 px past the edge, where their time and their cross could not be reached */
  #app .activity-log { max-height: none; }
  #app .log-pill { white-space: normal; max-width: 100%; }
  #app .log-pill .log-dismiss { min-width: 32px; min-height: 32px; padding: 8px 6px; margin: -8px -4px -8px 0; font-size: 15px; }
  .ocx-prof-btn { min-height: 34px; padding-top: 6px; padding-bottom: 6px; }   /* "Profil v" of the overclock table was 20 px high */
  .mining-link { display: inline-block; padding: 8px 0; }   /* "La retirer de ..." in the window of cards was 18 px high */

  /* the thread slider of a processor flight sheet: the value ("32 cores / 64 threads") goes under the slider on a narrow screen instead of past the edge */
  #app .mining-cores-row { flex-wrap: wrap; }
  #app .mining-cores-row input[type="range"] { flex: 1 1 100%; box-sizing: content-box; height: 6px; padding: 11px 0; background-clip: content-box; }   /* a 28 px band to grab, the track keeps its 6 px */
  #app .mining-cores-val { white-space: normal; }

  /* ------------------------------------------------------------------ an ASIC's page: its four buttons with their names (the old phone rule kept only the icons) */
  #app .asic-toolbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  #app .asic-toolbar .icon-btn.labeled { width: 100%; min-width: 0; height: 54px; padding: 4px 2px; flex-direction: column; justify-content: center; gap: 4px; border-radius: 11px; background: var(--bg-card); border: 1px solid var(--border); }
  #app .asic-toolbar .icon-btn.labeled .icon-btn-emoji { font-size: 18px; line-height: 1; }
  #app .asic-toolbar .icon-btn.labeled .icon-btn-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; font-size: 10px; font-weight: 600; line-height: 1.1; text-align: center; overflow-wrap: break-word; }

  /* ------------------------------------------------------------------ menus that open under a button: lines you can hit with a thumb */
  .dropdown-menu { min-width: 210px; }
  .dropdown-menu a { padding: 13px 12px; font-size: 15px; }

  /* the bell's window: its three buttons wrap under the title instead of squeezing the words */
  .notif-head, .notif-head-btns { flex-wrap: wrap; }
  .notif-head-btns .btn { white-space: nowrap; }
  .notif-panel { max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); }

  /* ------------------------------------------------------------------ buttons you can hit: a thumb-sized height everywhere (the small ones were 28 px) */
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; padding-top: 7px; padding-bottom: 7px; }
  .chip-filter { min-height: 36px; }
  #app .gpu-row-gear { width: 38px; height: 38px; }
  #app .mining-line-actions { flex-wrap: wrap; justify-content: flex-start; }   /* "Console / 6 cartes / Retirer" went past the edge of its card */
  #app .mining-line-actions > * { flex: 1 1 auto; }
  #app .mining-console { padding: 9px 12px; }
  #app .mining-remove { width: auto; padding: 0 12px; gap: 6px; }   /* its words (Retirer) stuck out of a button made 34 px wide for an icon */

  /* ------------------------------------------------------------------ windows: they fit the visible screen (100dvh = without the browser's own bars, which hid the bottom of a window), and their buttons stay at the bottom while the content scrolls */
  #modal-root .modal-backdrop { padding: 10px 8px; }
  #modal-root .modal { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); padding: 20px 16px 0; border-radius: 14px; }
  #modal-root .modal h2 { font-size: 18px; margin-bottom: 14px; }
  #modal-root .modal-actions { position: sticky; bottom: 0; z-index: 3; margin: 14px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg-elevated); border-top: 1px solid var(--border); }
  #modal-root .modal-actions .btn { flex: 1 1 0; justify-content: center; min-height: 44px; }

  /* the round support button: a little smaller, so it hides less of a page (it sat on top of the "Copier" button of the install command) */
  #mfchat .mfc-launcher { width: 50px; height: 50px; }
  #mfchat .mfc-launcher svg { width: 23px; height: 23px; }

  /* ------------------------------------------------------------------ the page itself */
  #app .container { padding-bottom: 96px; }   /* the round chat button at the bottom right no longer sits on the last line of a page */
}
