/* p3nd.online home mobile fixes — test/injection stylesheet only.
   Scope: home route content (#view) and shared mobile chrome. Desktop is untouched. */
@media (max-width: 600px) {
  /* The page-wide ornament otherwise stretches across and overlays readable content. */
  body > .top-ornament { display: none; }
  /* The old login artwork is unavailable; reuse the learning page's existing image. */
  .login-art { width: 130px; height: 130px; margin: 0 auto 10px; border: 4px solid var(--gold); border-radius: 50%; background: url("img/child-sm.jpg") center 20% / cover no-repeat; }
  .login-art img { display: none; }
  /* Keep the fixed mobile chrome inside the viewport and preserve safe areas. */
  .top {
    gap: 6px;
    padding-inline: 10px;
  }
  .brand {
    gap: 7px;
    min-width: 0;
    flex: 1 1 auto;
  }
  .brand svg,
  .brand > svg {
    width: 40px !important;
    height: 40px !important;
  }
  .brand b {
    font-size: 18px;
  }
  .brand small {
    font-size: 10px;
  }
  .brand-sub {
    display: none;
  }
  .top .tools {
    gap: 4px;
    flex: 0 0 auto;
  }
  .top .tools .icon-btn {
    width: 38px;
    height: 38px;
  }
  .me-chip {
    max-width: 88px;
  }

  #view {
    width: 100%;
    min-width: 0;
    padding: 18px 12px calc(34px + env(safe-area-inset-bottom));
  }

  /* Home welcome card: stack the image so Arabic copy never gets squeezed. */
  #view .welcome-card-tej {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 18px 14px;
    border-radius: 20px;
  }
  #view .welcome-card-tej > img {
    width: 82px !important;
    height: 82px !important;
    justify-self: center;
    grid-row: 1;
  }
  #view .welcome-card-tej > div {
    min-width: 0;
    grid-row: 2;
    text-align: center;
  }
  #view .welcome-card-tej h1 {
    font-size: clamp(25px, 8vw, 34px);
    overflow-wrap: anywhere;
  }
  #view .welcome-card-tej p {
    overflow-wrap: anywhere;
  }
  #view .welcome-chips {
    justify-content: center;
    gap: 6px;
  }
  #view .welcome-chips > span {
    padding: 6px 9px;
    font-size: 13px;
  }

  /* Inline-styled home action panels need a flexible, shrinkable text column. */
  #view > section > a.panel {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  #view > section > a.panel > div {
    min-width: 0;
  }
  #view > section > a.panel .track {
    flex: 0 1 70px !important;
    min-width: 44px;
  }
  #view > section > a.panel > span:last-child {
    flex: 0 0 auto;
  }
  #view .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  #view .actions .btn {
    flex: 1 1 150px;
    min-height: 44px;
    white-space: normal;
  }

  /* Do not let long titles or inline labels force horizontal scrolling. */
  #view h1, #view h2, #view h3, #view p, #view small, #view b {
    overflow-wrap: anywhere;
  }
  #view .page-head {
    margin-bottom: 16px;
  }
  #view .page-head p {
    font-size: 14px;
  }
  #view .mgrid.g3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  #view .card-surah {
    min-width: 0;
    padding: 12px 8px !important;
  }

  /* Keep the daily strip readable at 320px without hiding its progress. */
  #view .daily-task-list {
    grid-template-columns: 1fr;
  }
  #view .daily-mission-header {
    align-items: flex-start;
  }
  #view .daily-progress-summary {
    min-width: 76px;
  }

  /* Seven navigation items: compact labels, still touch-friendly. */
  .tabbar {
    padding-inline: 2px;
  }
  .tabbar a {
    min-width: 0;
    padding-inline: 0;
    font-size: 10px;
  }
  .tabbar a i {
    font-size: 17px;
  }
}

@media (max-width: 360px) {
  .brand small {
    display: none;
  }
  .brand b {
    font-size: 16px;
  }
  .top .tools .icon-btn {
    width: 36px;
    height: 36px;
  }
  .me-chip {
    max-width: 72px;
    font-size: 11px;
    padding-inline: 6px;
  }
  #view {
    padding-inline: 10px;
  }
  #view .welcome-card-tej {
    padding-inline: 12px;
  }
  #view .welcome-chips > span {
    padding-inline: 7px;
    font-size: 12px;
  }
}
