/* ============================================================
   YOUR PROGRESS — styles for #screen-progress (progress.js)
   Only tokens from the design system in index.html, so light and
   dark both work. Nothing here styles another screen, except the
   account initial on the existing top-bar button.
   ============================================================ */

/* ---------- top bar: the account button when signed in ---------- */
#btn-account .acct-initial {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  /* accent-deep, not accent: white on accent is only 3.1:1 and this is small text */
  background: var(--accent-deep); color: var(--on-strong);
  font-family: var(--font-display); font-weight: 800; font-size: 13px; line-height: 1;
  text-transform: uppercase;
}
#btn-account.signed-in { border-color: var(--line-strong); }
@media (max-width: 400px) {
  #btn-account .acct-initial { width: 22px; height: 22px; font-size: 11.5px; }
}

/* ---------- shared pieces ---------- */
#pg-root { --pg-gap: 14px; }
#pg-root h2 {
  font-family: var(--font-display); font-weight: 800; font-size: 23px;
  letter-spacing: -.02em; margin: 26px 0 8px;
}
#pg-root h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 17.5px;
  letter-spacing: -.01em; margin: 22px 0 6px;
}
#pg-root h4 { font-size: 14.5px; font-weight: 700; margin: 0 0 7px; }
#pg-root > section:first-child > h2:first-child { margin-top: 0; }
#pg-root p { overflow-wrap: break-word; }
#pg-root .of { font-weight: 400; font-size: .62em; }

.pg-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pg-btn-row .btn { flex: none; }
.btn.danger { background: var(--bad); color: var(--on-strong); border-color: transparent; }
.btn.danger-text { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

.pg-input {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 7px 10px;
  max-width: 100%;
}
[data-theme="dark"] .pg-input { color-scheme: dark; }
.pg-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* a state chip: colour, a shape AND a word, so colour is never the only signal */
.pg-chip, .pg-band {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: baseline;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  padding: 2px 9px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--card-2);
  white-space: nowrap;
}
.pg-chip [aria-hidden], .pg-band [aria-hidden] { font-size: 11px; line-height: 1; }
.pg-chip.is-above, .pg-band.is-above { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); background: color-mix(in srgb, var(--good) 13%, var(--card)); }
.pg-chip.is-above [aria-hidden], .pg-band.is-above [aria-hidden] { color: var(--good); }
.pg-chip.is-unclear, .pg-band.is-unclear { border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); background: color-mix(in srgb, var(--gold) 13%, var(--card)); }
.pg-chip.is-unclear [aria-hidden], .pg-band.is-unclear [aria-hidden] { color: var(--gold-ink); }
.pg-chip.is-below, .pg-band.is-below { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
.pg-chip.is-below [aria-hidden], .pg-band.is-below [aria-hidden] { color: var(--bad); }
.pg-chip.is-few [aria-hidden] { color: var(--muted); }

.pg-trend { font-weight: 700; white-space: nowrap; }
.pg-trend.is-up { color: var(--good); }
.pg-trend.is-down { color: var(--bad); }
.pg-trend.is-flat { color: var(--muted); }

.domain-tag.sm { font-size: 11px; padding: 1px 7px; }

.pg-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 12px; padding: 0; }
.pg-legend.sm { font-size: 12.5px; color: var(--muted); margin-top: 8px; align-items: center; }
.pg-legend .sw { display: inline-block; vertical-align: middle; margin-right: 5px; }
.pg-legend .pt-sw { width: 11px; height: 11px; border-radius: 50%; background: var(--accent-deep); }
.pg-legend .pr-sw { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--muted); }
.pg-legend .ln-sw { width: 20px; height: 0; border-top: 2px dashed var(--ink-soft); }
.pg-legend .bar-sw { width: 9px; height: 13px; border-radius: 2px; background: color-mix(in srgb, var(--accent-deep) 70%, var(--card)); }
.pg-legend .line-sw { width: 20px; height: 0; border-top: 2px solid var(--accent-deep); }

.pg-empty {
  background: var(--card-2); border: 1px dashed var(--line-strong); border-radius: 14px;
  padding: 16px 18px; margin: 10px 0;
}
.pg-empty p { color: var(--ink-soft); font-size: 14.5px; }
.pg-empty .btn { margin-top: 10px; }

.pg-facts { list-style: none; padding: 0; margin: 6px 0 0; }
.pg-facts li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.pg-facts li:last-child { border-bottom: 0; }

.pg-link {
  font: inherit; background: none; border: 0; padding: 0; text-align: left;
  color: var(--accent-deep); font-weight: 600; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent-deep) 40%, transparent);
}
.pg-link:hover { text-decoration-color: currentColor; }

/* wide tables keep their scrolling to themselves */
.pg-scroll { overflow-x: auto; margin: 8px 0 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pg-table { border-collapse: collapse; width: 100%; min-width: 430px; font-size: 13.5px; }
.pg-table th, .pg-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pg-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--card-2); }
.pg-table tbody tr:last-child th, .pg-table tbody tr:last-child td { border-bottom: 0; }
.pg-table tbody th[scope="row"] { font-weight: 600; }
.pg-grid-table td { font-variant-numeric: tabular-nums; }
.pg-grid-table td.is-above { background: color-mix(in srgb, var(--good) 13%, var(--card)); }
.pg-grid-table td.is-unclear { background: color-mix(in srgb, var(--gold) 13%, var(--card)); }
.pg-grid-table td.is-below { background: color-mix(in srgb, var(--bad) 11%, var(--card)); }

.pg-details { margin: 6px 0 2px; }
.pg-details > summary {
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent-deep);
  padding: 5px 2px; border-radius: 8px; width: fit-content;
}
.pg-details > summary:hover { text-decoration: underline; }

/* ============================================================
   the sign-in question (§5.4)
   ============================================================ */
.pg-ask {
  background: linear-gradient(135deg, var(--card) 55%, var(--accent-soft));
  border: 2px solid var(--accent); border-radius: 18px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.pg-ask h2 { margin: 0 0 6px; font-size: 20px; }
.pg-ask p { font-size: 14.5px; color: var(--ink-soft); }
.pg-ask-sides { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.pg-ask-side {
  flex: 1 1 180px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
}
.pg-ask-side .k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.pg-ask-side ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }

/* ============================================================
   HEADER (§3.1)
   ============================================================ */
.pg-head {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px 20px;
  display: grid; gap: 16px 22px;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.25fr);
  align-items: start;
}
.pg-id { display: grid; gap: 10px; align-content: start; }
.pg-who { display: flex; align-items: center; gap: 11px; }
.pg-avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-deep); color: var(--on-strong);
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
}
.pg-names { display: grid; min-width: 0; }
.pg-names .nm {
  font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pg-xp { max-width: 360px; }
.pg-xp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }

.pg-save { border-top: 1px solid var(--line); padding-top: 10px; }
.pg-save-line { font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.pg-save .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-top: 5px; }
.pg-save.is-ok .dot { background: var(--good); }
.pg-save.is-busy .dot { background: var(--accent); }
.pg-save.is-warn .dot { background: var(--gold); }
.pg-save.is-bad .dot { background: var(--bad); }
.pg-save-why { margin-top: 4px; }

.pg-ach { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pg-ach-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 13px;
  padding: 9px 12px; transition: border-color .15s, transform .15s;
  min-width: 0;
}
.pg-ach-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pg-ach-card .ic { font-size: 20px; flex: none; }
.pg-ach-card .t { display: grid; min-width: 0; }
.pg-ach-card .k { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pg-ach-card .v { font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.pg-ach-card .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* how close the next trophy is */
.pg-mini { display: block; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 4px; }
.pg-mini > span { display: block; height: 100%; border-radius: 99px; background: var(--gold); }

.pg-exam {
  grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px;
  display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; justify-content: space-between;
}
.pg-exam-l { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.pg-exam-l label { font-size: 14px; font-weight: 600; }
.pg-exam-ctl { display: flex; align-items: center; gap: 8px; }
.pg-exam-txt { flex: 1 1 240px; min-width: 0; text-align: right; }

/* ============================================================
   OVERVIEW (§3.2)
   ============================================================ */
.pg-verdict {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent);
  border-radius: 16px; box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 16px;
}
.pg-verdict.tone-above { border-left-color: var(--good); background: linear-gradient(100deg, color-mix(in srgb, var(--good) 9%, var(--card)), var(--card) 46%); }
.pg-verdict.tone-unclear, .pg-verdict.tone-taper { border-left-color: var(--gold); background: linear-gradient(100deg, color-mix(in srgb, var(--gold) 11%, var(--card)), var(--card) 46%); }
.pg-verdict.tone-below { border-left-color: var(--bad); background: linear-gradient(100deg, color-mix(in srgb, var(--bad) 9%, var(--card)), var(--card) 46%); }
.pg-vhead { font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; line-height: 1.25; }
.pg-vdetail { font-size: 14.5px; color: var(--ink-soft); margin-top: 5px; }
.pg-verdict .next-step { margin-bottom: 0; }
/* the next step's second line sits on the tinted box (here and on the hall): muted grey falls just under 4.5:1 there */
.next-step .muted { color: var(--ink-soft); }
/* the next step can run to several lines: keep its icon beside the first one */
.pg-verdict .next-step .ic { align-self: flex-start; margin-top: 1px; }

.pg-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pg-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 16px; min-width: 0;
}
.pg-tile .k { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pg-tile .v {
  font-family: var(--font-display); font-weight: 800; font-size: 25px; letter-spacing: -.025em;
  line-height: 1.15; margin: 2px 0 4px; overflow-wrap: anywhere;
}
.pg-tile .s { font-size: 12.8px; line-height: 1.45; color: var(--ink-soft); }
.pg-tile .s.muted, .pg-tile .muted { color: var(--muted); }
.pg-tile .s + .s { margin-top: 2px; }
.pg-tile .pg-btn-row { margin-top: 8px; }

.pg-gap {
  margin: 14px 0 0; padding: 12px 15px; font-size: 14px; color: var(--ink-soft);
  background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
}

.pg-drows { display: grid; gap: 4px; }
.pg-drow {
  display: grid; align-items: center; gap: 6px 10px; padding: 7px 8px; border-radius: 12px;
  grid-template-columns: auto minmax(0, 1fr) minmax(88px, 22%) 92px 116px auto;
  grid-template-areas: "tag nm track val mock drill";
  border-bottom: 1px solid var(--line);
}
.pg-drow:last-child { border-bottom: 0; }
.pg-drow:hover { background: var(--card-2); }
.pg-drow > .domain-tag { grid-area: tag; }
.pg-drow .nm { grid-area: nm; font-size: 14px; min-width: 0; }
.pg-drow .track { grid-area: track; position: relative; height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.pg-drow .cov { position: absolute; inset: 0 auto 0 0; background: var(--line-strong); }
.pg-drow .acc { position: absolute; inset: 0 auto 0 0; }
.pg-drow .target { position: absolute; top: -1px; bottom: -1px; left: 72%; width: 2px; background: var(--ink); opacity: .6; }
.pg-drow .val { grid-area: val; font-size: 13.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-drow .mock { grid-area: mock; font-size: 13px; text-align: right; white-space: nowrap; }
.pg-drow .btn { grid-area: drill; }

/* ============================================================
   TABS
   ============================================================ */
.pg-tabs { margin: 26px 0 0; }
.pg-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.pg-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 4px 20px 22px; margin-top: 12px;
}
.pg-panel h2 { font-size: 21px; }
.pg-panel > h2:first-child { margin-top: 20px; }
.pg-panel h2:focus { outline: none; }
.pg-panel > p { font-size: 14.5px; color: var(--ink-soft); }

.pg-list { display: grid; }
.pg-list .focus-row:last-child { border-bottom: 0; }

/* ---------- Weak spots: the task statement map (§3.3) ---------- */
.pg-map-group { margin: 0 0 14px; }
.pg-map-group h4 { display: flex; align-items: center; gap: 8px; }
.pg-map-group h4 .nm { font-weight: 600; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px; }
.pg-cell {
  display: grid; gap: 1px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card-2); border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 7px 9px; min-width: 0; transition: transform .12s;
}
.pg-cell:hover { transform: translateY(-2px); }
.pg-cell .id { font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: -.01em; }
.pg-cell .pc { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-cell .pc .sh { font-size: 11px; }
.pg-cell .nn { font-size: 11.5px; color: var(--muted); }
.pg-cell.is-above { border-color: color-mix(in srgb, var(--good) 58%, var(--line)); background: color-mix(in srgb, var(--good) 13%, var(--card)); }
.pg-cell.is-above .sh { color: var(--good); }
.pg-cell.is-unclear { border-color: color-mix(in srgb, var(--gold) 62%, var(--line)); background: color-mix(in srgb, var(--gold) 13%, var(--card)); }
.pg-cell.is-unclear .sh { color: var(--gold-ink); }
.pg-cell.is-below { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
.pg-cell.is-below .sh { color: var(--bad); }
.pg-cell.is-few { border-style: dashed; background: var(--card-2); }
.pg-cell.is-few .sh, .pg-cell.is-few .pc { color: var(--muted); }
.pg-cell.is-open { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
/* the one the verdict's next step points at */
.pg-cell.is-worst { border-width: 2.5px; border-color: var(--accent-deep); }
.pg-cell.is-worst .id::after { content: ' ★'; color: var(--accent-deep); font-size: 11px; }
.pg-chip.is-worst { border-color: color-mix(in srgb, var(--accent-deep) 60%, var(--line)); background: var(--accent-soft); }
.pg-chip.is-worst [aria-hidden] { color: var(--accent-deep); }

.pg-cell-detail {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  justify-content: space-between;
  background: var(--card-2); border: 1px solid var(--accent); border-radius: 14px;
  padding: 12px 15px; margin: 1px 0 4px;
}
.pg-cell-detail .d-main { flex: 1 1 260px; min-width: 0; }
.pg-cell-detail .d-title { font-size: 14.5px; }
.pg-cell-detail .d-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-stem { font-size: 13.5px; color: var(--ink-soft); overflow-wrap: anywhere; }

/* ---------- Mock exams (§3.4) ---------- */
.pg-chart { margin: 8px 0 2px; min-height: 60px; }
.pg-chart svg { display: block; max-width: 100%; height: auto; }
.pg-chart-ctl { margin: 2px 0 4px; }
.pg-svg text { font-family: var(--font-body); fill: var(--muted); font-size: 11.5px; }
.pg-svg text.pass { fill: var(--ink-soft); font-weight: 700; }
.pg-svg .grid { stroke: var(--line); stroke-width: 1; }
.pg-svg .passline { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .8; }
.pg-svg .spark { fill: none; stroke: var(--accent-deep); stroke-width: 2; stroke-linejoin: round; }
.pg-svg .rng { stroke: var(--line-strong); stroke-width: 2; }
.pg-svg .pt { fill: var(--accent-deep); stroke: var(--card); stroke-width: 1.5; }
.pg-svg .pt.is-above { fill: var(--good); }
.pg-svg .pt.is-unclear { fill: var(--gold); }
.pg-svg .pt.is-below { fill: var(--bad); }
.pg-svg .pt.is-line { fill: var(--accent-deep); }
.pg-svg .pt-practice { fill: var(--card); stroke: var(--muted); stroke-width: 2; }
.pg-svg .wbar { fill: color-mix(in srgb, var(--accent-deep) 70%, var(--card)); }

.pg-atts { display: grid; gap: 6px; margin-top: 8px; }
.pg-att { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.pg-att.is-open { border-color: var(--accent); }
.pg-att-head {
  display: grid; align-items: center; gap: 4px 12px; width: 100%; text-align: left;
  font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; padding: 10px 14px;
  grid-template-columns: 92px 150px 92px minmax(0, 1fr) 16px;
  grid-template-areas: "when score raw tags more";
}
.pg-att-head:hover { background: var(--card-2); }
.pg-att-head .when { grid-area: when; display: grid; }
.pg-att-head .score { grid-area: score; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.pg-att-head .raw { grid-area: raw; font-variant-numeric: tabular-nums; font-size: 14px; }
.pg-att-head .tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 5px; }
.pg-att-head .more { grid-area: more; color: var(--muted); text-align: right; }
.pg-att-body { padding: 2px 14px 14px; border-top: 1px solid var(--line); }
.pg-att-bars { display: grid; gap: 7px; margin: 8px 0 10px; }

/* ---------- Activity (§3.5) ---------- */
.pg-streak { margin: 12px 0 0; font-size: 15px; }
.pg-recs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 8px 0 0; }
.pg-recs > div { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; }
.pg-recs dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pg-recs dd { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; margin: 1px 0 0; }

/* ---------- Learn (§3.6) ---------- */
.pg-learn-top { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; margin-top: 8px; }
.pg-learn-top .pg-btn-row { margin-top: 0; }
.pg-big { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.025em; line-height: 1.1; }
.pg-bars { display: grid; gap: 8px; margin-top: 6px; }
.pg-recent { list-style: none; padding: 0; margin: 6px 0 0; }
.pg-recent li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.pg-recent li:last-child { border-bottom: 0; }

/* ---------- Data on this device (§3.7) ---------- */
.pg-data {
  margin-top: 26px; padding: 16px 20px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 18px;
}
.pg-data h2 { margin-top: 0; font-size: 19px; }
.pg-data-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.pg-data-row .btn { flex: none; }

/* ============================================================
   the confirm dialog
   ============================================================ */
.pg-dlg-wrap {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 20px; background: rgba(28, 22, 14, .55);
}
[data-theme="dark"] .pg-dlg-wrap { background: rgba(0, 0, 0, .66); }
.pg-dlg {
  width: min(460px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 18px;
  box-shadow: var(--shadow-big); padding: 22px 24px;
}
.pg-dlg.is-danger { border-color: color-mix(in srgb, var(--bad) 55%, var(--line-strong)); }
.pg-dlg h2 { font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -.02em; margin: 0 0 8px; }
.pg-dlg-body { font-size: 14.5px; color: var(--ink-soft); display: grid; gap: 8px; }
.pg-dlg-body .pg-warn {
  background: color-mix(in srgb, var(--bad) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--line));
  border-radius: 10px; padding: 9px 12px; color: var(--ink);
}
.pg-dlg-type { display: block; font-size: 13.5px; margin: 14px 0 5px; }
.pg-dlg #pg-dlg-in { width: 100%; }
.pg-dlg-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.pg-dlg-foot .btn { flex: none; }

/* ============================================================
   narrower screens, down to 320px
   ============================================================ */
@media (max-width: 1000px) {
  .pg-drow {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "tag nm drill"
      "track track track"
      "val val mock";
    align-items: start; padding: 10px 8px;
  }
  .pg-drow .nm { line-height: 1.35; }
  .pg-drow .nm .muted { display: block; }
  .pg-drow .val { text-align: left; }
  .pg-drow > .domain-tag { margin-top: 2px; }
}
@media (max-width: 860px) {
  .pg-head { grid-template-columns: minmax(0, 1fr); }
  .pg-exam-txt { text-align: left; }
  .pg-att-head {
    grid-template-columns: minmax(0, 1fr) auto 16px;
    grid-template-areas:
      "when score more"
      "raw  raw   raw"
      "tags tags  tags";
  }
  .pg-att-head .when { display: flex; gap: 8px; align-items: baseline; }
  .pg-att-head .score { text-align: right; }
}
@media (max-width: 760px) {
  .pg-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  #pg-root h2 { font-size: 20px; }
  #pg-root h3 { font-size: 16.5px; }
  .pg-panel { padding: 2px 14px 18px; }
  .pg-head { padding: 15px 16px; }
  .pg-tile .v { font-size: 21px; }
  .pg-tile { padding: 11px 13px; }
  .pg-ach { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* the sub line wraps rather than being cut off, now that the cards are narrow */
  .pg-ach-card .s { white-space: normal; overflow: visible; line-height: 1.3; }
  .pg-ach-card { padding: 8px 10px; gap: 7px; }
  .pg-ach-card .ic { font-size: 17px; }
  .pg-ach-card .v { font-size: 14.5px; }
  .pg-learn-top { display: grid; }
  .pg-exam { display: grid; }
  .pg-map { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
  .pg-cell { padding: 6px 7px; }
  .pg-cell .id { font-size: 13px; }
  .pg-cell .pc { font-size: 12px; }
  .pg-data { padding: 14px 16px; }
  .pg-data-row .btn, .pg-btn-row .btn { flex: 1 1 auto; }
  .pg-dlg { padding: 18px 16px; }
}
@media (max-width: 380px) {
  .pg-tiles { gap: 8px; }
  .pg-tile .v { font-size: 19px; }
  .pg-tile .s { font-size: 12.2px; }
  .pg-map { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .pg-avatar { width: 36px; height: 36px; font-size: 16px; }
  .pg-names .nm { font-size: 18px; }
  .pg-legend { gap: 5px 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-ach-card, .pg-cell { transition: none; }
  .pg-ach-card:hover, .pg-cell:hover { transform: none; }
}
