/* The rock pages as a phone app (About rocks, My rocks, Battle arena, Trading post).
   On a phone-sized screen the five tabs become a bar along the bottom, the top bar shrinks to the logo and your Twitch
   name, and everything is laid out tighter. Wider screens are untouched. Loaded after each page's own styles. */
@media (max-width: 760px) {
  html:not(.embed) body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  /* ---- top bar: logo, name, music, your Twitch name ---- */
  html:not(.embed) .s0nav .s0in { height: 50px; padding: 0 10px; gap: 8px; }
  html:not(.embed) .s0nav .s0links { display: none; }
  html:not(.embed) .s0brand { padding-left: 46px; margin-right: 0; }
  html:not(.embed) .s0brand img { width: 42px; height: 42px; top: 4px; left: 0; }
  html:not(.embed) .s0brand img.rkweek { width: 38px; height: 38px; top: 6px; left: 2px; border-radius: 10px; box-shadow: 0 0 0 1px #2b2b30; }
  html:not(.embed) .s0brand span { display: inline; font-size: 17px; letter-spacing: .5px; }
  html:not(.embed) .s0right { gap: 6px; }
  html:not(.embed) #authBox > .btn, html:not(.embed) .s0modl { display: none; }
  html:not(.embed) .s0tw.in b { max-width: 96px; }
  html:not(.embed) .s0tw:not(.in) span { display: inline; }
  html:not(.embed) .s0staff .s0in2 { padding: 0 10px; height: 34px; }

  /* ---- the five tabs, along the bottom ---- */
  html:not(.embed) .wrap > .subnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; width: auto; max-width: none; margin: 0 !important;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border: 0; border-top: 1px solid #2b2b30; border-radius: 0; background: #101012f2; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  html:not(.embed) .wrap > .subnav a, html:not(.embed) .wrap > .subnav a .s0iw {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  }
  html:not(.embed) .wrap > .subnav a {
    position: relative; min-width: 0; padding: 6px 2px 5px; border-radius: 10px; background: none; color: #8f9099;
    font: 700 10.5px/1.1 Inter, system-ui, sans-serif; white-space: nowrap; text-align: center;
  }
  html:not(.embed) .wrap > .subnav a .gn { display: none; }      /* the first tab is just "About" on a phone */
  html:not(.embed) .wrap > .subnav a .s0i { width: 25px; height: 25px; vertical-align: 0; opacity: .72; }
  html:not(.embed) .wrap > .subnav a.on { background: none; color: #fff; }
  html:not(.embed) .wrap > .subnav a.on .s0i { opacity: 1; transform: translateY(-1px) scale(1.12); }
  html:not(.embed) .wrap > .subnav a.on::before { content: ""; position: absolute; top: -5px; left: 26%; right: 26%; height: 3px; border-radius: 0 0 3px 3px; background: #e3262f; }
  html:not(.embed) .wrap > .subnav .s0bdg { position: absolute; top: 2px; left: 50%; margin: 0 0 0 8px; }
  html:not(.embed) #toast { bottom: calc(78px + env(safe-area-inset-bottom)) !important; }

  /* ---- everything tighter ---- */
  .wrap { padding: 0 12px; }
  .pagehead { padding: 14px 0 0 !important; }
  .pagehead h1 { font-size: 26px; line-height: 1.05; }
  .pagehead .rule { margin: 8px 0 8px; }
  .pagehead > p { display: none; }
  h2.sec { font-size: 17px; margin: 20px 0 8px; }
  h2.sec small { display: none; }
  .secsub { font-size: 13px; }
  footer { margin-top: 22px; padding: 16px 0; font-size: 11.5px; }
  footer .fanote { font-size: 10.5px !important; }
  /* pop-up windows slide up from the bottom, like a sheet */
  .modal { align-items: flex-end; padding: 0; }
  .modal .box, .modal .box.wide { width: 100%; max-width: none; max-height: 90vh; border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .btn { min-height: 38px; }

  /* ---- My rocks ---- */
  .prof { grid-template-columns: 76px 1fr !important; text-align: left !important; gap: 10px; padding: 10px 12px 12px; margin-top: 12px; align-items: start; }
  .prof canvas { width: 76px !important; height: 66px !important; margin: 2px 0 0 !important; }
  .prof h1 { font-size: 19px; line-height: 1.1; }
  .prof .title { font-size: 12.5px; margin-top: 2px; }
  .prof .stats, .medals { justify-content: flex-start !important; gap: 5px; margin-top: 8px; }
  .prof .stats .stat { display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 8px; min-width: 0; border-radius: 8px; }
  .prof .stats .stat b { font-size: 14px; }
  .prof .stats .stat span { font-size: 11px; margin: 0; }
  .medals .medal, .medals > * { font-size: 11px; padding: 3px 8px; }
  .prof p.muted { font-size: 12px !important; margin-top: 8px !important; }
  .optd > summary h2.sec { margin: 16px 0 8px; }
  .optd > summary h2.sec small { display: none; }
  .optd > summary::after { margin-top: 8px !important; margin-left: auto; }
  .fopts { padding: 2px 12px 10px; }
  .autof { font-size: 13.5px; }
  .autof small { display: block; margin: 2px 0 0 26px; font-size: 12px; }
  .fopts .fnote { font-size: 12.5px; }
  .sechead { gap: 6px; }
  .sechead .btn { margin: 0 0 10px; width: 100%; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
  .grid .card { padding: 22px 4px 8px; border-radius: 12px; min-width: 0; }
  .grid .card canvas { width: 88px; height: 76px; max-width: 100%; }
  .grid .card .cn { font-size: 11.5px; line-height: 1.2; overflow-wrap: anywhere; }
  .grid .card .ct { font-size: 10.5px; }
  .grid .card .tag { font-size: 8px; letter-spacing: .4px; padding: 2px 5px; top: 5px; }
  .grid .card .tag.up { font-size: 0; padding: 0; width: 10px; height: 10px; border-radius: 50%; top: 7px; right: 7px; }
  .fgrid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px; }
  .fslot { height: 92px; }
  .fslot canvas { width: 64px; height: 56px; }
  .fq { width: 54px; height: 48px; margin-bottom: 12px; }
  .fq i { font-size: 24px; }
  .fnm { font-size: 9.5px; }
  .folder { padding: 8px 8px 10px; }
  .folder::before { font-size: 11px; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
  .fpage { padding: 8px 8px 10px; }
  .citem { flex-basis: 96px; }
  .needin { margin: 16px 0 6px; padding: 18px 16px; }
  .needin h2 { font-size: 21px; }

  /* ---- About rocks ---- */
  .tree, .paths { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .step, .path { padding: 6px 8px 10px !important; }
  .step canvas { height: 92px !important; }
  .step h3, .path h3 { font-size: 13.5px !important; }
  .step .no { font-size: 17px !important; top: 6px !important; left: 9px !important; }
  .path canvas { height: 84px !important; }
  .lb .lbr, .feed > div { font-size: 13px; }

  /* ---- Battle arena and Trading post: the inner tabs become one swipeable row ---- */
  .tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; margin-top: 12px !important; gap: 2px !important; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; padding: 9px 11px !important; font-size: 13px !important; white-space: nowrap; }
  .pane { margin-top: 12px !important; }
  .offer { padding: 10px; gap: 8px; }
  .hint { font-size: 12.5px; }
}
/* ---- far fewer words on a phone: the explaining lives on About rocks, behind its fold-out headings ---- */
@media (max-width: 760px) {
  .secsub, .hint, .xt { display: none !important; }
  .pane h2.sub + .hint { display: block !important; font-size: 12.5px; }
  h2.sub small, .needin .muted { display: none !important; }
  h2.sub { font-size: 16px !important; margin: 16px 0 8px !important; }
  .pagehead .rule { display: none; }
  .pagehead h1 { margin-bottom: 4px; }
  /* My rocks */
  .prof p.muted, .autof small, .fopts .fnote, .optd > summary h2.sec small { display: none !important; }
  .grid .card .ct:not(.pct) { display: none; }
  .grid .card .wl, .grid .card .rec { font-size: 10px; }
  .stnote, #uFavNote, .modal .box p.muted { display: none !important; }
  .cnone { font-size: 12px; }
  /* About rocks: the four steps become picture and title only */
  .how .step p, .tree .step p, .step > p, .path > p { display: none; }
  .how .step h3, .step h3 { margin-bottom: 0; }
  details > summary { font-size: 14px; }
  /* Battle arena */
  p.how { display: none; }
  .closed p, .aclosed p, .stage .closed p { font-size: 13px; }
  .team h3 small { display: none; }
  /* Trading post */
  .pane ~ .rules { display: none; }
  .offer .when { font-size: 11px; }
  .ptag .want b { display: none; }
  .mcount { font-size: 11.5px; }
  .modal p { font-size: 13px; margin-bottom: 10px; }
}
/* opened from the home screen (added as an app): no browser bars, so leave room for the phone's own status bar */
@media (display-mode: standalone) {
  .s0nav { padding-top: env(safe-area-inset-top); }
}
