/* Logged-in student navigation: four actions, two columns on mobile. */
#study999-student-nav[hidden] {display:none!important}
#study999-student-nav {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;width:100%;max-width:760px;align-items:stretch}
#study999-student-nav .study999-student-nav-btn {box-sizing:border-box;display:flex;gap:7px;justify-content:center;align-items:center;min-width:0;min-height:43px;padding:9px 12px;border:1px solid transparent;border-radius:11px;font:600 14px/1.25 system-ui,'Microsoft YaHei',sans-serif;white-space:nowrap;cursor:pointer;transition:background-color .15s,border-color .15s,box-shadow .15s}
#study999-student-nav svg {flex:none}
#study999-student-nav .nav-courses {color:#0f766e;background:#f0fdfa;border-color:#99f6e4}
#study999-student-nav .nav-scores {color:#1d4ed8;background:#eff6ff;border-color:#bfdbfe}
#study999-student-nav .nav-settings {color:#6d28d9;background:#f5f3ff;border-color:#ddd6fe}
#study999-student-nav .nav-logout {color:#b91c1c;background:#fff7f7;border-color:#fecaca}
#study999-student-nav .study999-student-nav-btn.is-active:not(.nav-logout) {color:#fff;background:#2563eb;border-color:#2563eb;box-shadow:0 2px 6px #2563eb29}
#study999-student-nav .study999-student-nav-btn:hover {filter:brightness(.96)}
#study999-student-nav .study999-student-nav-btn:focus-visible {outline:3px solid #93c5fd;outline-offset:2px}
body.study999-logged-nav #home,body.study999-logged-nav #account,body.study999-logged-nav #logout,body.study999-logged-nav #portal-links {display:none!important}
#portal-link-feedback {display:none!important}
@media(max-width:720px){#study999-student-nav{grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px}#study999-student-nav .study999-student-nav-btn{min-height:45px;padding:9px 7px;font-size:14px}}
@media(prefers-reduced-motion:reduce){#study999-student-nav .study999-student-nav-btn{transition:none}}


/* study999-mobile-header-layout-v1
   修复手机端登录后的 Logo、网站名称和四个导航按钮重叠。
   不修改未登录页面、桌面端或按钮事件。
*/

@media screen and (max-width: 720px) {

  /* 页头允许换行：品牌信息一行，导航独占下一行。 */
  body.study999-logged-nav > header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    box-sizing: border-box !important;
    padding: 12px 14px !important;
    gap: 10px !important;
  }

  /* 保留主站 Logo，但防止图片占满手机屏幕。 */
  body.study999-logged-nav > header img {
    max-width: 76px !important;
    max-height: 64px !important;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
  }

  /* 网站名称适配手机宽度，避免文字挤压导航。 */
  body.study999-logged-nav > header
  .study999-site-title {
    font-size: clamp(18px, 5vw, 25px) !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;

    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* 导航独占页头第二行，不与 Logo 争抢宽度。 */
  body.study999-logged-nav > header > nav {
    display: block !important;

    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 四个按钮固定两列、两行。 */
  body.study999-logged-nav
  #study999-student-nav {
    display: grid !important;

    grid-template-columns:
      repeat(2, minmax(0, 1fr)) !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;

    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  /* 未登录或隐藏状态仍然隐藏导航。 */
  body.study999-logged-nav
  #study999-student-nav[hidden] {
    display: none !important;
  }

  /* 避免按钮文字超出手机屏幕。 */
  body.study999-logged-nav
  #study999-student-nav
  .study999-student-nav-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;

    box-sizing: border-box !important;

    margin: 0 !important;
    padding: 10px 6px !important;

    gap: 5px !important;

    font-size: clamp(12px, 3.5vw, 14px) !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    text-align: center !important;

    overflow-wrap: anywhere;
  }

  body.study999-logged-nav
  #study999-student-nav
  .study999-student-nav-btn svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
  }

  body.study999-logged-nav
  #study999-student-nav
  .study999-student-nav-btn span {
    min-width: 0;
  }

}

