/*
 * The legacy data pages on phones (Daniel, 2026-10-24: "make sure the old screens are
 * mobile optimized"). Progress, Fitness, Technical and Tactical open from the player dashboard's tabs
 * and render in the legacy layout (views/layouts/layout.ejs).
 *
 * Loaded only with the app on, and every rule is under body.lgx (set by the layout then), so the
 * legacy app is unchanged with the flag off. The layout then draws the app header on every legacy
 * page (2026-10-24); past that, desktop is unchanged: the page rules sit in phone and tablet media
 * queries. Colours and type follow assets/assets/css/app.css.
 */

/* ---------- the app header (views/partials/appHeader.ejs, assets/assets/css/app-header.css) ---------- */
/* It replaces the theme's header and navs on every legacy page and sits in the page's flow, so the
   room the theme kept for its fixed phone header goes. */
body.lgx .lg-header { position: relative; z-index: 1031; }
@media (max-width: 991px) {
    body.lgx .main-content { padding-top: 0; }
}

/* ---------- Progress (#progress) ---------- */
@media (max-width: 767px) {
    body.lgx #progress .stickyHeader { margin-top: 0 !important; }
    body.lgx #progress .p-5 { padding: 16px 4px !important; }
    body.lgx #progress .px-5 { padding-left: 4px !important; padding-right: 4px !important; }
    body.lgx #progress .pb-5 { padding-bottom: 16px !important; }
    body.lgx #progress .pt-3 { padding-top: 8px !important; }
    body.lgx #progress h1 { font-size: 1.9rem; }
    body.lgx #progress .trackRow > .col-3 { padding: 0 4px; }
    body.lgx #progress .trackBox { width: 100%; }
    body.lgx #progress .trackDigit { font-size: 1.1rem; white-space: nowrap; }
    body.lgx #progress .trackDigitDesc { font-size: 0.75rem; white-space: nowrap; }
    body.lgx #progress .layout-spacing { padding-bottom: 16px; }
    body.lgx #progress .my-5 { margin-top: 16px !important; margin-bottom: 16px !important; }
    /* The tracked metrics two across. */
    body.lgx #progress .statRow > .col-12.col-lg-2 { flex: 0 0 50%; max-width: 50%; padding: 0 5px 10px !important; }
    body.lgx #progress .statCard { width: 100%; min-height: 0; margin: 0; padding: 14px 8px; }
    body.lgx #progress .statName { font-size: 1.05rem; line-height: 1.2; }
    body.lgx #progress .statDesc { font-size: 0.8rem; margin: 4px 0 0; }
    /* "Select Metric to View" and "Save to Player": one under the other, full width. */
    body.lgx #progress .mainDrop { width: 100% !important; margin: 12px 0 0 !important; }
    body.lgx #progress .mainDrop .btn { white-space: normal; }
}

/* ---------- Fitness (#teamEvent) ---------- */
@media (max-width: 767px) {
    /* Nested p-5 / p-4 / column paddings left a third of the screen for three rings. */
    body.lgx #teamEvent .p-5 { padding: 8px 0 !important; }
    body.lgx #teamEvent .p-4 { padding: 12px 6px !important; }
    body.lgx #teamEvent .col-12.p-4 { padding: 0 !important; }
    body.lgx #teamEvent .row.p-4 > .col-12 { padding-left: 4px; padding-right: 4px; }
    body.lgx #teamEvent .row.p-4 > .col-12 > .row[style*="padding"] { padding: 0 !important; margin: 0; }
    body.lgx #teamEvent .pt-5 { padding-top: 16px !important; }
    /* The summary's four rings two by two, each side's three rings in one row. */
    body.lgx #teamEvent .row > .col-12.col-md-6.col-lg-3 { flex: 0 0 50%; max-width: 50%; }
    body.lgx #teamEvent .row > .col-12.col-md-6.col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; padding-left: 2px; padding-right: 2px; }
    /* The rings are a fixed 100 px; a third of a phone is less, so each side's rings shrink. */
    body.lgx #teamEvent .col-lg-4 .progress-item { width: 78px; height: 78px; }
    body.lgx #teamEvent .col-lg-4 .progress-item::after { width: 78px; margin: 7px; }
    body.lgx #teamEvent .col-lg-4 h4 { font-size: 1rem; }
    body.lgx #teamEvent .col-lg-4 h4 + p { font-size: 0.7rem; }
    body.lgx #teamEvent .col-lg-4 h5, body.lgx #teamEvent .col-lg-3 h5 { font-size: 0.85rem; line-height: 1.2; }
    body.lgx #teamEvent .col-lg-4 h5 + p, body.lgx #teamEvent .col-lg-3 h5 + p { font-size: 0.7rem; }
    body.lgx #teamEvent .row.p-4 > .col-12.col-md-4.col-lg-2 { padding-top: 4px !important; padding-bottom: 4px !important; text-align: left !important; }
    body.lgx #teamEvent .row.p-4 > .col-12.col-md-4.col-lg-2 * { text-align: left !important; }
    /* The load distribution legend wraps under its title. */
    body.lgx #teamEvent .row.pb-5 > .col-12[style*="space-between"] { flex-wrap: wrap; justify-content: flex-start !important; gap: 8px 14px; }
    body.lgx #teamEvent .row.pb-5 > .col-12[style*="space-between"] > p { flex: 0 0 100%; margin: 0; }
    body.lgx #teamEvent .row.pb-5 > .col-12[style*="space-between"] > div { align-items: center; }
    body.lgx #teamEvent .row.pb-5 > .col-12[style*="space-between"] > div p { margin: 0; font-size: 12px; white-space: nowrap; }
    body.lgx #teamEvent .row.pb-5 { padding-bottom: 16px !important; }
}

/* ---------- the match header (Tactical, Shifts, Replay, Heatmap) ---------- */
@media (max-width: 767px) {
    /* The two teams side by side, the date and arena under them (three columns squeezed every word onto its own line). */
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 0; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing > .col-4 { max-width: none; padding: 12px !important; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing > .col-4:nth-child(1) { grid-column: 1; grid-row: 1; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing > .col-4:nth-child(3) { grid-column: 2; grid-row: 1; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing > .col-4:nth-child(2) { grid-column: 1 / span 2; grid-row: 2; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing h3 { font-size: 1.1rem; margin: 0; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .col-lg-8 > .row.layout-spacing p { margin-bottom: 4px; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .pt-5 { padding-top: 16px !important; }
    body.lgx :is(#impact, #toi, #replay, #heatmap) .px-4 { padding-left: 4px !important; padding-right: 4px !important; }
}

/* ---------- Technical (#skill-profile) ---------- */
@media (max-width: 767px) {
    body.lgx #skill-profile .pt-5 { padding-top: 16px !important; }
    body.lgx #skill-profile .px-4 { padding-left: 4px !important; padding-right: 4px !important; }
    body.lgx #skillRadar { height: 360px !important; }
    /* A category's details: seven nested paddings left the bars 189 of 375 px, labels cut to two letters. */
    body.lgx #skill-profile .col-md-6.col-12.layout-spacing { padding-left: 0; padding-right: 0; }
    body.lgx #skill-profile .card-body[style*="2.2rem"] { padding: 18px 14px !important; }
    body.lgx #skill-profile .card .col-12.py-4 { padding-left: 0; padding-right: 0; }
    body.lgx #skill-profile .card .row.pb-1 > .col-12,
    body.lgx #skill-profile .card .row.pb-3 > .col-12 { padding-left: 0; padding-right: 0; }
    /* Each stat's label above its bar, the value beside the bar on one line. */
    body.lgx #skill-profile .card .row[style*="height: 25px"] { height: auto !important; flex-wrap: wrap; margin: 0 0 6px; }
    body.lgx #skill-profile .card .row[style*="height: 25px"] > .col-2 { flex: 0 0 100%; max-width: 100%; padding: 0; }
    body.lgx #skill-profile .card .row[style*="height: 25px"] > .col-2:empty { display: none; }
    body.lgx #skill-profile .card .row[style*="height: 25px"] > .col-10 { flex: 0 0 100%; max-width: 100%; padding: 0; }
    body.lgx #skill-profile .card .evalBarTitle { font-size: 12px !important; line-height: 16px; text-align: left; padding: 0; margin: 0; white-space: normal; }
    body.lgx #skill-profile .card .evalBarValue { flex: none; min-width: 56px; white-space: nowrap; font-size: 12px; }
    /* Acceleration's Player / Bench / unit columns: one line each, narrow enough to leave the bar room. */
    body.lgx #skill-profile .card .evalBarValueCent { flex: none; width: 42px; min-width: 0; padding: 5px 2px; font-size: 11px; white-space: nowrap; }
    /* Endurance: the totals and the Best / Last 15 s boxes, each number on one line. */
    body.lgx #skill-profile .card .row.col-12.mb-1.pt-2 > .col-4 { padding-left: 2px; padding-right: 2px; }
    body.lgx #skill-profile .card .row.mb-3[style*="border: 1px solid"] { margin-left: 0 !important; flex-wrap: nowrap; }
    body.lgx #skill-profile .card .row.mb-3[style*="border: 1px solid"] > .col-1 { flex: 0 0 28px; max-width: 28px; padding: 6px 4px !important; }
    body.lgx #skill-profile .card .row.mb-3[style*="border: 1px solid"] > .col-3,
    body.lgx #skill-profile .card .row.mb-3[style*="border: 1px solid"] > .col-4 { flex: 1 1 0; max-width: none; padding-left: 2px; padding-right: 2px; }
    body.lgx #skill-profile .card .row.mb-3[style*="border: 1px solid"] h3,
    body.lgx #skill-profile .card .row.col-12.mb-1.pt-2 h3 { font-size: 1.15rem; white-space: nowrap; }
    body.lgx #skill-profile .card .row.mb-3[style*="border: 1px solid"] p,
    body.lgx #skill-profile .card .row.col-12.mb-1.pt-2 p { font-size: 11px; white-space: nowrap; }
    /* A value past the scale's top (a benchmark of 12 on a 10 scale) stops at the end of its track. */
    body.lgx #skill-profile .card .progress-bar { max-width: 100%; }
    /* The section title on its own line, the Game / Prac switch under it. */
    body.lgx #skill-profile .card .reportBar { flex-wrap: wrap; row-gap: 8px; justify-content: flex-start !important; }
    body.lgx #skill-profile .card .reportBar > li.mr-auto { display: none; }
    body.lgx #skill-profile .card .reportBar > h5 { flex: 0 0 100%; font-size: 1rem; }
}

/* ---------- Tactical (#impact) ---------- */
@media (max-width: 767px) {
    /* The team's bars and the player's tiles side by side. */
    body.lgx #impact .statField > .row > .col-10 { flex: 0 0 72%; max-width: 72%; padding: 0 8px 0 0; }
    body.lgx #impact .statField > .row > .col-12 { padding-left: 0; padding-right: 0; }
    body.lgx #impact .statField > .row > .col-2 { flex: 0 0 28%; max-width: 28%; padding: 0; }
    /* Every row the same height in both columns so a tile stays beside its bar: label on top, bar under it. */
    body.lgx #impact .statField .row[style*="height: 25px"] { height: 44px !important; margin: 0; flex-wrap: wrap; align-content: flex-end; }
    body.lgx #impact .statField .row[style*="height: 25px"] > [class*="col-"] { flex: 0 0 100%; max-width: 100%; padding: 0 !important; }
    body.lgx #impact .statField .row[style*="height: 25px"] > .col-2 { height: 18px; }
    body.lgx #impact .statField .row[style*="height: 25px"] > .col-2 > div { font-size: 12px !important; line-height: 18px; text-align: left !important; padding: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    body.lgx #impact .statField .row[style*="height: 25px"] > .col-2 > .aqua { font-size: 15px !important; font-weight: 600; }
    body.lgx #impact .statField .row[style*="height: 25px"] > [class*="col-"]:not(.col-2) { height: 26px; }
    body.lgx #impact .evalBarValueR, body.lgx #impact .evalBarValueL { flex: none; min-width: 52px; font-size: 12px; white-space: nowrap; }
    /* The column headings, small enough for two lines. */
    body.lgx #impact .statField .row.mb-3[style*="height: 25px"] .flexItem > div { font-size: 13px !important; line-height: 1.2; }
    body.lgx #impact .statField .row.mb-3[style*="height: 25px"] > [class*="col-"]:not(.col-2) { height: auto; }
    /* The player's tile sits level with the bar, not the label (its colour is the row's background). */
    body.lgx #impact .statField > .row > .col-2 .row[style*="height: 25px"]:not(.mb-3) { padding-top: 18px; background-clip: content-box !important; }
    body.lgx #impact .statField > .row > .col-2 .row[style*="height: 25px"] > [class*="col-"] { height: 26px; }
    body.lgx #impact .statField > .row > .col-2 .evalBarTitle { font-size: 12px !important; line-height: 26px; text-align: center !important; padding: 0; margin: 0; white-space: nowrap; overflow: hidden; }
    /* The quarter lines are drawn a fixed 380 / 860 px tall for 25 px rows; on a phone they would stop short. */
    body.lgx #impact .statField div[style*="height: 380px"],
    body.lgx #impact .statField div[style*="height: 860px"] { display: none; }
}

/* ---------- Shifts (#toi) ---------- */
@media (max-width: 767px) {
    /* The Shift Length / Top Speed / Top Accel switch across the top, the range and its slider under it. */
    body.lgx #toi .row.bg-deepblue > .col-3,
    body.lgx #toi .row.bg-deepblue > .col-9 { flex: 0 0 100%; max-width: 100%; padding: 0; }
    body.lgx #toi .row.bg-deepblue .reportBar { flex-direction: row !important; justify-content: stretch !important; margin: 0; padding: 0; }
    body.lgx #toi .row.bg-deepblue .reportBar > a { flex: 1 1 0; min-width: 0; min-height: 44px !important; display: flex; align-items: center; justify-content: center; padding: 6px 4px; }
    body.lgx #toi .row.bg-deepblue .reportBar .skew-nav-text { font-size: 13px; white-space: nowrap; }
    body.lgx #toi .row.bg-deepblue .col-9 > .row { margin: 0; }
    body.lgx #toi .row.bg-deepblue .col-9 > .row > .col-3,
    body.lgx #toi .row.bg-deepblue .col-9 > .row > .col-9 { flex: 0 0 100%; max-width: 100%; padding: 4px 12px !important; }
    body.lgx #toi .range_control { justify-content: flex-start; gap: 10px; padding: 8px 0; }
    /* Each player: number and position, then shifts / average / time on ice, the shift bar under them. */
    body.lgx #toi .widget-content > .row { margin: 0 0 8px; }
    body.lgx #toi .widget-content > .row > .col-1 { flex: 0 0 34%; max-width: 34%; order: 0; padding: 0; }
    body.lgx #toi .widget-content > .row > .col-2 { flex: 0 0 66%; max-width: 66%; order: 1; padding: 0; }
    body.lgx #toi .widget-content > .row > .col-2 > div { width: 33.333% !important; }
    body.lgx #toi .widget-content > .row > .col-9 { flex: 0 0 100%; max-width: 100%; order: 2; padding: 0; }
    body.lgx #toi .widget-content > .row > .col-9:not(:has(*)) { display: none; }
    body.lgx #toi .widget-content .evalBarTitle { font-size: 12px !important; margin: 0; }
}

/* ---------- Replay (#replay) ---------- */
@media (max-width: 767px) {
    /* The saved clips table scrolls on its own instead of running off the page. */
    body.lgx #replay table.table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---------- every page ---------- */
@media (max-width: 767px) {
    body.lgx .layout-px-spacing { padding: 0 12px !important; }
    body.lgx .table-responsive, body.lgx #teamEvent table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
