/* The one top bar (2026-12-03): every pupil page (/hw, /live, /m, /fm) and the
   staff tools' pages. Self-contained (no fms.css variables), as /m and /fm load
   only this. Made by fms_nav() in hw/lib.php. */
.hgs-nav { --nav-bg: #1a1d21; --nav-ink: #c9ced3; --nav-on: #F8D60A;
    position: relative; z-index: 50; display: flex; flex-wrap: nowrap; align-items: center; gap: 4px 18px; padding: 0 18px; min-height: 54px;
    background: var(--nav-bg); color: #fff; font: 15px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.hgs-nav * { box-sizing: border-box; }
.hgs-nav a { text-decoration: none; }
.hgs-nav a:hover { opacity: 1; }                      /* the staff tools' own a:hover fades links */
.hgs-brand { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 8px 0; }
.hgs-brand img { height: 26px; width: auto; display: block; }
.hgs-tabs { display: flex; align-items: stretch; gap: 2px; flex: 1 1 auto; min-width: 0; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.hgs-tabs::-webkit-scrollbar { display: none; }
.hgs-tabs > a { position: relative; display: flex; align-items: center; padding: 0 12px; color: var(--nav-ink); font-weight: 600; white-space: nowrap; border-radius: 0; }
.hgs-tabs > a:hover { color: #fff; background: rgba(255,255,255,.06); }
.hgs-tabs > a.on { color: #fff; }
.hgs-tabs .hgs-ext { margin-left: 4px; opacity: .6; font-size: .85em; }   /* a tab that opens another site (Marking) */
.hgs-tabs > a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--nav-on); }
.hgs-me { position: relative; flex: 0 0 auto; }
.hgs-me > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 8px 6px 6px; border-radius: 999px; color: #fff; font-weight: 600; }
.hgs-me > summary::-webkit-details-marker { display: none; }
.hgs-me > summary:hover, .hgs-me[open] > summary { background: rgba(255,255,255,.1); }
.hgs-me > summary::after { content: ""; width: 7px; height: 7px; border: solid #9aa0a6; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); margin: 0 4px 0 2px; }
.hgs-me img, .hgs-me .hgs-init { width: 30px; height: 30px; border-radius: 50%; display: block; object-fit: cover; }
.hgs-me .fms-av-gold { position: relative; display: block; }
.hgs-me .fms-av-medal { display: none; }
.hgs-init { display: grid !important; place-items: center; background: var(--nav-on); color: #1a1d21; font-weight: 800; font-size: 13px; }
.hgs-menu { position: absolute; z-index: 5; right: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; color: #23272b; border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.hgs-menu .hgs-mhead { padding: 8px 12px 10px; border-bottom: 1px solid #eee; margin-bottom: 4px; font-size: 13px; color: #6b6b6b; }
.hgs-menu .hgs-mhead b { display: block; color: #23272b; font-size: 15px; }
.hgs-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: #23272b; font-weight: 500; }
.hgs-menu a:hover, .hgs-menu a:focus-visible { background: #f2f3f5; color: #111; }
/* staff: the tabs are the staff home page's headings, each a menu of its tools */
.hgs-tabs-dd { overflow: visible; }
.hgs-dd { position: relative; display: flex; }
.hgs-dd > summary { list-style: none; position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--nav-ink); font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; }
.hgs-dd > summary::-webkit-details-marker { display: none; }
.hgs-dd > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); opacity: .7; transition: transform .15s; }
.hgs-dd[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.hgs-dd > summary:hover, .hgs-dd[open] > summary { color: #fff; background: rgba(255,255,255,.06); }
.hgs-dd.on > summary { color: #fff; }
.hgs-dd.on > summary::before { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--nav-on); }
.hgs-ddmenu { left: 0; right: auto; top: 100%; min-width: 230px; }
.hgs-ddmenu hr { border: 0; border-top: 1px solid #eee; margin: 4px 6px; }
.hgs-ddmenu a span { color: #9aa0a6; font-size: .85em; }
.hgs-ddmenu a.cur { background: #fff8cc; font-weight: 700; }
/* Documents: the six lists from /staff in columns */
.hgs-docs { width: min(860px, calc(100vw - 170px)); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; padding: 10px; }
.hgs-ddgrp { min-width: 0; }
.hgs-ddh { padding: 6px 12px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8a8f94; }
.hgs-docs a { padding: 7px 12px; font-size: 14px; }
.hgs-signin { color: #fff; font-weight: 600; margin-left: auto; }
/* --hgs-bar-h: the bar's height, for staff tools that size themselves to the
   window (rp's columns are 100dvh less its toolbar, and now less this too).
   A first guess here so the first paint is right; nav.js keeps it exact. */
html:has(.hgs-staffbar) { --hgs-bar-h: 54px; }
.hgs-staffbar { box-shadow: inset 0 -1px 0 #353b42; }    /* a line between it and a tool's own dark toolbar */
html:has(.hgs-staffbar.hgs-min) { --hgs-bar-h: 16px; }
@media (max-width: 860px) { html:has(.hgs-staffbar:not(.hgs-min)) { --hgs-bar-h: 90px; } }
/* staff: fold the bar away to a thin strip, and back (nav.js; the hgs_bar cookie remembers it) */
.hgs-hide { flex: 0 0 auto; width: 30px; height: 30px; margin: 0 -8px 0 -10px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #8a9096; cursor: pointer; display: grid; place-items: center; }
.hgs-hide::before { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 2px 0 0 2px; transform: translateY(2px) rotate(45deg); }
.hgs-hide:hover, .hgs-hide:focus-visible { color: #fff; background: rgba(255,255,255,.1); }
.hgs-show { display: none; }
.hgs-nav.hgs-min { min-height: 0; height: 16px; padding: 0; }
.hgs-nav.hgs-min > :not(.hgs-show) { display: none !important; }
.hgs-nav.hgs-min > .hgs-show { display: flex; align-items: center; justify-content: center; width: 100%; height: 16px; margin: 0; padding: 0; border: 0; background: transparent; color: #8a9096; font: 700 10.5px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.hgs-show span { display: inline-flex; align-items: center; gap: 6px; }
.hgs-show span::after { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-1px) rotate(45deg); }
.hgs-nav.hgs-min > .hgs-show:hover, .hgs-nav.hgs-min > .hgs-show:focus-visible { color: #fff; background: #2a2f35; }
.hgs-tabs .s { display: none; }                      /* a tab's short name, for phones */
.fm-btn[hidden] { display: none !important; }         /* /m and /fm: Teacher tools, hidden from pupils */
/* phones and narrow windows: the logo and menu on one line, the tabs a swipeable row under them */
@media (max-width: 860px) {
    .hgs-nav { flex-wrap: wrap; padding: 0 12px; min-height: 0; }
    .hgs-brand { padding: 9px 0; }
    .hgs-brand img { height: 22px; }
    .hgs-me { margin-left: auto; }
    .hgs-hide { margin: 0 -6px 0 -6px; }
    .hgs-tabs-dd { overflow-x: auto; }
    .hgs-dd { flex: 1 0 auto; }
    .hgs-dd > summary { flex: 1 0 auto; justify-content: center; padding: 12px 10px; font-size: 14px; }
    .hgs-ddmenu { position: fixed; left: 12px; right: 12px; top: var(--dd-top, 100px); width: auto; min-width: 0; max-height: calc(100vh - var(--dd-top, 100px) - 12px); overflow-y: auto; }
    .hgs-ddmenu a { padding: 11px 12px; }
    .hgs-docs { width: auto; max-width: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .hgs-me .hgs-name { display: none; }
    .hgs-tabs { order: 3; flex: 1 0 100%; margin: 0 -12px; padding: 0 6px; border-top: 1px solid #2c3137; }
    .hgs-tabs > a { flex: 1 0 auto; justify-content: center; padding: 12px 10px; font-size: 14px; }
}
/* phones: short names (Race, Maths, FM), so every tab fits without swiping */
@media (max-width: 600px) {
    .hgs-tabs { padding: 0 2px; }
    .hgs-tabs .l { display: none; }
    .hgs-tabs .s { display: inline; }
    .hgs-tabs > a, .hgs-dd > summary { padding: 12px 7px; font-size: 13.5px; }
    .hgs-dd > summary { gap: 4px; }
    .hgs-tabs > a.on::after { left: 6px; right: 6px; }
}
@media (max-width: 560px) { .hgs-docs { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 370px) { .hgs-tabs > a, .hgs-dd > summary { padding: 12px 5px; font-size: 12.5px; } }
@media screen and (prefers-color-scheme: dark) {
    body.fms-pupil .hgs-nav { border-bottom: 1px solid #2a2e33; }
    body.fms-pupil .hgs-menu { background: #24282d; color: #e6e8ea; }
    body.fms-pupil .hgs-menu a { color: #e6e8ea; }
    body.fms-pupil .hgs-menu a:hover { background: #30353b; }
    body.fms-pupil .hgs-menu .hgs-mhead { border-color: #353a40; color: #9aa0a6; }
    body.fms-pupil .hgs-menu .hgs-mhead b { color: #e6e8ea; }
}
:fullscreen .hgs-nav { display: none; }      /* the Live Race board alone on the projector */
@media print { .hgs-nav { display: none; } }

/* A site-chrome page given the staff bar instead of the masthead (/games:
   includes/header.php adds the class): the dashboards' grey page. */
@media screen and (prefers-color-scheme: light) {
    body.hgs-has-staffbar { background: #f4f4f2; }
}

/* The pupil-view banner under the bar on pages outside /hw, which do not load
   fms.css (fms_nav() adds it). Same look as fms.css's. */
.fms-viewbar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; background: #6d28d9; color: #fff; padding: 10px 20px; font: 500 .95rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
.fms-viewbar > span { flex: 1 1 260px; }
.fms-viewbar .btn { display: inline-block; padding: 6px 12px; border: 1px solid #fff; border-radius: 8px; background: #fff; color: #4c1d95; font-weight: 700; font-size: .88rem; text-decoration: none; }
.fms-viewbar .btn:hover { background: #ede9fe; }
