/**
 * NS PHP8 lift — additive responsive layer
 * Desktop (≥992px): keep original fixed ~1000px portal look.
 * Tablet (≤991px) / Phone (≤767px): fluid width, stacked columns, wrap nav.
 * Breakpoints: 991px, 767px, 480px.
 */
html { -webkit-text-size-adjust: 100%; }
img, video, iframe { max-width: 100%; }
/* Numeric captcha is a small PNG; do not let the rule above shrink it. */
img.ns-vc,
img[src*="pic_vc.php"] {
  width: auto;
  height: auto;
  max-width: none;
}
#ns-nav-toggle { display: none; }

@media screen and (max-width: 991px) {
  #mainbody {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  #header {
    height: auto !important;
    min-height: 120px;
    background-size: cover !important;
    background-position: center top !important;
  }
  #header .logo {
    margin: 12px 0 0 12px !important;
    max-width: 55%;
    height: auto !important;
  }
  #header .linian {
    display: none !important; /* decorative; saves space on tablet/phone */
  }
  #navbar {
    width: 100% !important;
    height: auto !important;
    margin-top: 8px !important;
    background-size: cover !important;
  }
  #navbar ul {
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    float: none !important;
    justify-content: flex-start;
  }
  #navbar ul li {
    float: none !important;
    width: auto !important;
    min-width: 72px;
    margin: 4px 6px !important;
    height: auto !important;
  }
  #navbar ul li a {
    float: none !important;
    display: inline-block;
    width: auto !important;
    min-height: 36px;
    line-height: 36px;
    padding: 0 10px;
    letter-spacing: normal !important;
    box-sizing: border-box;
  }
  #loginbox {
    height: auto !important;
    min-height: 36px;
    line-height: 1.4 !important;
    overflow: hidden;
  }
  .loginbox1 iframe {
    width: 100% !important;
    max-width: 100%;
  }
  .loginbox2 {
    float: none !important;
    width: auto !important;
  }
  #content .left,
  #content .middle,
  #content .right {
    float: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 0 12px 0 !important;
    box-sizing: border-box;
    padding: 0 8px !important;
  }
  #content .middle {
    min-height: 420px;
  }
  #content .middle iframe,
  #content iframe {
    width: 100% !important;
    min-height: 480px;
    height: 70vh !important;
  }
  #content .school_pic {
    width: 46% !important;
    height: auto !important;
    margin: 8px 2% !important;
  }
  #netid { display: none !important; }
  #pdgg, .pdgg { display: none !important; }
}

@media screen and (max-width: 767px) {
  body { font-size: 15px !important; }
  #ns-nav-toggle {
    display: block;
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 50;
    background: rgba(0, 70, 120, 0.9);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 16px;
    min-height: 44px;
    cursor: pointer;
  }
  #header { position: relative; padding-bottom: 8px; }
  #navbar {
    display: none;
    margin-top: 0 !important;
  }
  #navbar.ns-nav-open {
    display: block !important;
  }
  #navbar ul {
    flex-direction: column !important;
    background: #035a8c;
  }
  #navbar ul li {
    width: 100% !important;
    margin: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: left !important;
  }
  #navbar ul li a {
    display: block !important;
    width: 100% !important;
    padding: 12px 16px !important;
    min-height: 44px;
    line-height: 20px;
    text-align: left;
  }
  #header .logo {
    max-width: 70%;
    margin: 16px 0 0 12px !important;
  }
  #content .school_pic {
    width: 96% !important;
    margin: 8px 2% !important;
  }
  /* list / article pages (active_app) */
  #content, #list_nf, #list_nf ul {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  #list_nf ul li a {
    display: block;
    padding: 8px 4px;
    line-height: 1.4;
  }
  table {
    max-width: 100%;
    display: block;
    overflow-x: auto;
  }
}

@media screen and (max-width: 480px) {
  #loginbox .loginbox2 { display: none; } /* clock/favorite clutter */
  #content .middle iframe,
  #content iframe {
    min-height: 360px;
    height: 65vh !important;
  }
}

/* Login page (kernel login.php) — additive */
@media screen and (max-width: 767px) {
  #main {
    width: 92% !important;
    max-width: 420px;
    margin: 12% auto 0 auto !important;
  }
  .title { font-size: 22px !important; }
  .line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
  }
  .tt {
    width: 28% !important;
    display: inline-block !important;
  }
  .input, input[type=text], input[type=password] {
    width: 68% !important;
    min-height: 40px;
    font-size: 16px; /* avoid iOS zoom */
    box-sizing: border-box;
  }
  #pvcode { min-height: 40px; font-size: 16px; }
  input[type=submit] {
    min-height: 44px;
    min-width: 88px;
    margin: 6px 4px;
    font-size: 16px;
  }
  /* Cap tiny page/go controls — do not stretch to 68% */
  #list_more_title input[type=text],
  #list_more_title input.input-mini,
  input.input-mini[type=text],
  input.input-mini[type=password] {
    width: auto !important;
    max-width: 4em !important;
    min-width: 2.5em;
    min-height: 32px;
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
  }
  #list_more_title input[type=submit],
  input.input-mini-btn[type=submit] {
    width: auto !important;
    min-width: 44px;
    max-width: 5em;
    display: inline-block;
    vertical-align: middle;
  }
}


/* Tiny list pager inputs (desktop + mobile) — size=3 must stay compact */
#list_more_title input[name="page"],
input.input-mini {
  width: auto !important;
  max-width: 4em !important;
  box-sizing: border-box;
}
#list_more_title td[width="150px"] {
  width: 150px !important;
  white-space: nowrap;
}
