/*
 * Mobile learner header + achievements refinement.
 * Loaded only by learn.php; all rules are mobile-scoped and additive.
 */

@media (max-width: 600px) {
  html.learner-ui .site-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }

  html.learner-ui .site-head .brand {
    flex: 1 1 220px;
    min-width: 0;
    align-items: flex-start;
    gap: 9px;
  }

  html.learner-ui .site-head .brand > span {
    min-width: 0;
    padding-top: 1px;
  }

  html.learner-ui .site-head .brand b {
    font-size: clamp(18px, 5.7vw, 22px);
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html.learner-ui .site-head .brand small {
    max-width: 30ch;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.45;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  html.learner-ui .site-head .brand .brand-sub {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.35;
    color: var(--muted);
    white-space: normal;
  }

  html.learner-ui .site-head .tools {
    flex: 1 0 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 1px;
  }

  html.learner-ui .site-head .tools .me-chip {
    min-width: 0;
    max-width: min(58vw, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.learner-ui .site-head .tools .icon-btn {
    width: 38px;
    height: 38px;
  }

  html.learner-ui #view {
    min-width: 0;
    padding: 20px 12px calc(104px + env(safe-area-inset-bottom));
  }

  html.learner-ui #view > section:has(> .achievement-grid) .page-head {
    margin-bottom: 16px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .page-head h2 {
    font-size: clamp(23px, 7vw, 30px);
  }

  html.learner-ui #view > section:has(> .achievement-grid) .page-head p {
    font-size: 13px;
    line-height: 1.75;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .achievement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 14px 0;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .achievement-card {
    min-width: 0;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 9px;
    border-radius: 15px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .achievement-card strong {
    font-size: clamp(24px, 8vw, 32px);
    line-height: 1.15;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .achievement-card p {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
    overflow-wrap: anywhere;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .panel {
    min-width: 0;
    padding: 15px 11px;
    border-radius: 17px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .panel > h3 {
    font-size: 18px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .panel > p.muted {
    font-size: 12px;
    line-height: 1.7;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .panel .mgrid.g2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .panel .mgrid.g2 .achievement-card {
    min-height: 80px;
    padding: 10px 7px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .panel .mgrid.g2 .achievement-card strong {
    font-size: 22px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .days {
    display: grid;
    grid-template-columns: repeat(14, minmax(0, 1fr));
    gap: 4px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .days i {
    width: auto;
    aspect-ratio: 1;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .plist {
    min-width: 0;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .prow {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    padding: 12px 0;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .prow-name {
    min-width: 0;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .prow-name b,
  html.learner-ui #view > section:has(> .achievement-grid) .prow-name small {
    overflow-wrap: anywhere;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .prow .track {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 350px) {
  html.learner-ui .site-head .brand .brand-sub {
    display: none;
  }

  html.learner-ui .site-head .tools .icon-btn {
    width: 36px;
    height: 36px;
  }

  html.learner-ui #view {
    padding-inline: 10px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .achievement-grid {
    gap: 7px;
  }

  html.learner-ui #view > section:has(> .achievement-grid) .achievement-card {
    padding-inline: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.learner-ui .site-head,
  html.learner-ui #view * {
    scroll-behavior: auto;
  }
}
