/* Page layout, after the "Study app – Dataverket UI" design. Components and colours come from
 * design/dataverket/dataverket.css (Designsystemet with Dataverket's theme).
 * No hex values here: use --ds-* variables. */

body { margin: 0; }
strong { font-weight: 600; } /* Inter ships in 400, 500 and 600 only. */

kbd {
  font-family: var(--dvk-font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: 3px 6px;
  box-sizing: border-box;
  border: 1px solid var(--ds-color-neutral-border-default);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--ds-color-neutral-surface-default);
  color: var(--ds-color-neutral-text-default);
}

/* The app fills the window; the site footer (outside #app) comes after it, below the fold. */
.pg-app { min-height: 100vh; display: flex; flex-direction: column; }
.pg-site-footer {
  display: flex;
  justify-content: center;
  gap: var(--ds-size-6);
  padding: var(--ds-size-4);
  border-top: 1px solid var(--ds-color-neutral-border-subtle);
  font-size: var(--ds-font-size-2);
}

/* A legal text (the privacy policy): a readable column; tables scroll inside their box on a
 * narrow screen instead of widening the page. */
.pg-legal { width: 100%; max-width: 72ch; box-sizing: border-box; margin: 0 auto; padding: var(--ds-size-10) var(--ds-size-8) var(--ds-size-14); display: flex; flex-direction: column; gap: var(--ds-size-4); }
.pg-legal > * { margin-block: 0; }
.pg-legal > h2 { margin-top: var(--ds-size-6); }
.pg-legal ul { margin: 0; padding-left: var(--ds-size-6); display: flex; flex-direction: column; gap: var(--ds-size-2); font-size: var(--ds-font-size-4); line-height: 1.5; }
.pg-table-scroll { overflow-x: auto; }
.pg-legal .ds-table th, .pg-legal .ds-table td { vertical-align: top; }
.pg-legal .ds-table td { min-width: 12rem; }

/* Surfaces are neutral; the accent is kept for what can be pressed or is selected. A card
 * reads the accent's surface by default, which in the dark scheme is navy, so every card
 * and stat tile turned into a blue block. These are the surface and border aliases only:
 * buttons and links inside a card keep their colours. */
.pg-app .ds-card:not([data-color]) {
  --ds-color-surface-default: var(--ds-color-neutral-surface-default);
  --ds-color-surface-tinted: var(--ds-color-neutral-surface-tinted);
  --ds-color-surface-hover: var(--ds-color-neutral-surface-hover);
  --ds-color-surface-active: var(--ds-color-neutral-surface-active);
  --ds-color-border-subtle: var(--ds-color-neutral-border-subtle);
  --dsc-card-color: var(--ds-color-neutral-text-default);
}
.pg-app .ds-card[data-variant="tinted"]:not([data-color]) { background: var(--ds-color-neutral-surface-tinted); }
/* The same for a details element that is not inside a card (the latest calls on the profile page). */
.pg-app .ds-details:not([data-color]) {
  --ds-color-surface-default: var(--ds-color-neutral-surface-default);
  --ds-color-surface-tinted: var(--ds-color-neutral-surface-tinted);
  --ds-color-surface-hover: var(--ds-color-neutral-surface-hover);
  --ds-color-surface-active: var(--ds-color-neutral-surface-active);
  --ds-color-border-subtle: var(--ds-color-neutral-border-subtle);
}
.pg-subtle { color: var(--ds-color-neutral-text-subtle); }
.pg-small { font-size: var(--ds-font-size-2); }
.pg-num { font-variant-numeric: tabular-nums; }
.pg-stack { display: flex; flex-direction: column; gap: var(--ds-size-2); }
.pg-stack > *, .pg-prose > * { margin-block: 0; }
.pg-prose { display: flex; flex-direction: column; gap: var(--ds-size-3); }
.pg-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-size-3); }
.pg-row--between { justify-content: space-between; }
.pg-eyebrow {
  font-size: var(--ds-font-size-1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-color-neutral-text-subtle);
}

/* Header and footer, shared by every screen */
.pg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-size-4);
  padding: var(--ds-size-4) var(--ds-size-8);
  border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
}
.pg-brand { display: flex; align-items: center; gap: var(--ds-size-2); }
/* A rule between the brand and what the page is about, so the two do not read as one line. */
.pg-header > .pg-brand:has(+ .pg-session-title, + a.ds-button, + .pg-crumbs) {
  padding-right: var(--ds-size-5);
  margin-right: var(--ds-size-1);
  border-right: 1px solid var(--ds-color-neutral-border-subtle);
}
.pg-brand-name { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; }
.pg-search { position: relative; flex: 1 1 320px; max-width: 520px; margin-left: var(--ds-size-6); }
.pg-search > input { width: 100%; padding-right: 48px; }
.pg-search > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.pg-header-actions { display: flex; align-items: center; gap: var(--ds-size-2); margin-left: auto; }
/* The user menu: the icon at the right of the header and the dropdown under it. The
   dropdown is a popover in the top layer, placed under the icon with anchor positioning;
   where that is missing, under the header's right corner. */
.pg-user { anchor-name: --pg-user; border: 0; }
.pg-user-menu {
  min-width: 14rem;
  inset: auto;
  top: calc(var(--ds-size-4) + var(--ds-size-12) + var(--ds-size-1));
  right: var(--ds-size-8);
  margin: 0;
}
@supports (anchor-name: --a) {
  .pg-user-menu {
    position-anchor: --pg-user;
    top: anchor(bottom);
    right: anchor(right);
    margin-top: var(--ds-size-2);
  }
}
.pg-user-menu > h2 { font-weight: 500; }
/* The breadcrumbs and the page's subtitle under them. */
.pg-crumbs { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pg-session-title { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pg-session-title > :first-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A session's page heading is the title in its header, drawn as that title was before it was one. */
.pg-session-h1 { margin: 0; font-size: inherit; line-height: inherit; }

.pg-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-size-2) var(--ds-size-6);
  padding: var(--ds-size-3) var(--ds-size-8);
  border-top: 1px solid var(--ds-color-neutral-border-subtle);
  background: var(--ds-color-neutral-background-tinted);
  font-size: var(--ds-font-size-2);
  color: var(--ds-color-neutral-text-subtle);
}
.pg-footer > span { display: inline-flex; align-items: center; gap: 4px; }
.pg-footer > .pg-end { margin-left: auto; }

/* Library */
.pg-library {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--ds-size-10);
  padding: var(--ds-size-10) var(--ds-size-8) var(--ds-size-14);
  max-width: 1440px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}
.pg-decks { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--ds-size-14); }

/* A section of a page: its heading block, then what it labels, ds-size-2 apart as Dataverket's
 * layout rule asks. The sections themselves are ds-size-14 apart (pg-decks, pg-deck, pg-home). */
.pg-library section.pg-stack, .pg-deck section.pg-stack, .pg-home section.pg-stack { gap: var(--ds-size-2); }
section.pg-stack > .pg-stack { gap: var(--ds-size-1); }
/* The page's first heading is a section heading like the others, not a second page title
 * under the one in the header. */
.pg-library h1.ds-heading, .pg-deck h1.ds-heading, .pg-home section.pg-stack h1.ds-heading { font-size: var(--ds-heading-sm-font-size); }
.pg-table-wrap { overflow-x: auto; contain: paint; border: 1px solid var(--ds-color-neutral-border-subtle); border-radius: var(--ds-border-radius-lg); }
/* contain: the row links' stretched ::after would otherwise widen the page on a phone. */
.pg-table-wrap > table { width: 100%; min-width: 720px; }

/* The list of decks on the subject page. A row is a link: the link in its first cell is
 * stretched over the whole row, so the row is clicked, hovered and focused as one. */
.pg-deck-table > tbody > tr { position: relative; cursor: pointer; }
.pg-deck-table > tbody > tr > td { vertical-align: middle; }
.pg-deck-table > thead th { white-space: nowrap; }
.pg-row-link { color: inherit; font-weight: 500; text-decoration: none; }
.pg-row-link::after { content: ""; position: absolute; inset: 0; }
.pg-deck-table > tbody > tr:hover .pg-row-link { text-decoration: underline; }
.pg-row-link:focus-visible { outline: none; }
.pg-row-link:focus-visible::after {
  box-shadow: var(--dsc-focus-boxShadow-inset);
  outline: var(--dsc-focus-outline);
  outline-offset: calc(-1 * var(--ds-border-width-focus));
}
/* The tabs under a subject's header: links between its pages, drawn as Designsystemet's
 * tabs draw theirs (ds-tabs is for tab panels on one page, not for links). */
.pg-tabs {
  display: flex;
  overflow-x: auto;
  padding: 0 var(--ds-size-8);
  border-bottom: var(--ds-border-width-default) solid var(--ds-color-neutral-border-subtle);
}
.pg-tabs > a {
  position: relative;
  padding: var(--ds-size-3) var(--ds-size-5);
  color: var(--ds-color-neutral-text-subtle);
  text-decoration: none;
  white-space: nowrap;
}
.pg-tabs > a::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: .15em; }
.pg-tabs > a:hover:not([aria-current]) { color: var(--ds-color-neutral-text-default); }
.pg-tabs > a:hover:not([aria-current])::after { background: var(--ds-color-neutral-border-subtle); }
.pg-tabs > a[aria-current="page"] { color: var(--ds-color-text-subtle); }
.pg-tabs > a[aria-current="page"]::after { background: var(--ds-color-text-subtle); }
.pg-tabs > a:focus-visible { outline: var(--dsc-focus-outline); outline-offset: calc(-1 * var(--ds-border-width-focus)); box-shadow: var(--dsc-focus-boxShadow-inset); }

/* The Material tab: the uploaded files, and the pages read from one of them. */
.pg-material-table > tbody > tr > td { vertical-align: middle; }
.pg-material-table > thead th { white-space: nowrap; }
.pg-material-name { font-weight: 500; overflow-wrap: anywhere; }
.pg-material-url { display: block; font-weight: 400; font-size: var(--ds-font-size-2); }
.pg-material-actions { justify-content: flex-end; flex-wrap: nowrap; gap: var(--ds-size-1); }
.pg-material-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; line-height: 1.6; font-size: var(--ds-font-size-3); }

.pg-row-open { width: var(--ds-size-6); color: var(--ds-color-neutral-text-subtle); }
.pg-row-open > svg { display: block; }
/* What a deck holds, a line per layer: the count, the mastery bar, the status. */
.pg-layer-lines { display: grid; grid-template-columns: 11rem minmax(6rem, 1fr) 6.5rem; align-items: center; gap: var(--ds-size-2) var(--ds-size-4); }
.pg-right { text-align: right; }
.pg-deck-name { display: flex; flex-direction: column; gap: 2px; }
.pg-deck-name > :first-child { font-weight: 500; }
.pg-mastery { display: flex; align-items: center; gap: var(--ds-size-2); }
.pg-mastery > span { min-width: 3ch; text-align: right; }
.pg-bar { flex: 1 1 auto; height: 8px; border-radius: 4px; background: var(--ds-color-neutral-surface-active); overflow: hidden; }
.pg-bar > div { height: 100%; border-radius: 4px; background: var(--ds-color-accent-base-default); transition: width 150ms ease; }
/* A mastery bar in two parts, mastered and right once, with a gap of the track between. */
.pg-bar:has(> .pg-bar-started) { display: flex; gap: 2px; }
/* Right once: the mastered colour in stripes, partly there. */
.pg-bar > .pg-bar-started { background: repeating-linear-gradient(-45deg, var(--ds-color-accent-base-default) 0 2px, transparent 2px 5px); }

/* What a subject or a deck holds, in numbers: a tile per layer. */
.pg-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: var(--ds-size-4); }
.pg-stat-card { display: flex; flex-direction: column; gap: var(--ds-size-2); --dsc-card-padding: var(--ds-size-4); }
.pg-stat-card > dd { margin: 0; }

/* A deck's page: one column, with the modes' blocks in a grid. */
.pg-deck {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--ds-size-14);
  padding: var(--ds-size-10) var(--ds-size-8) var(--ds-size-14);
  max-width: 1200px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}
/* Two blocks a row: four modes make a square instead of three and one left over. */
.pg-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(26rem, 100%), 1fr)); gap: var(--ds-size-4); }
.pg-block { display: flex; flex-direction: column; gap: var(--ds-size-4); --dsc-card-padding: var(--ds-size-6); }
.pg-block > * { margin-block: 0; }
.pg-block > .pg-start, .pg-block > :last-child:not(.pg-group) { margin-top: auto; }
.pg-block-head { display: flex; align-items: flex-start; gap: var(--ds-size-3); }
.pg-block-head h3 { margin: 0; }
.pg-block-icon { flex: none; display: inline-flex; color: var(--ds-color-accent-text-subtle); }
/* The blocks of the modes that belong to the subject, beside its decks. */
.pg-aside { flex: 1 1 380px; max-width: 460px; display: flex; flex-direction: column; gap: var(--ds-size-4); }

.pg-group { display: flex; flex-direction: column; gap: var(--ds-size-2); }
.pg-group > p { margin: 0; }
.pg-group-label { font-weight: 500; }
.pg-check { display: flex; align-items: center; gap: var(--ds-size-2); }
.pg-check > label { font-weight: 400; }
.pg-chips { display: flex; flex-wrap: wrap; gap: var(--ds-size-2); padding-top: var(--ds-size-2); }
.pg-start { width: 100%; justify-content: center; }

/* Sessions */
/* The progress bar sits on the same column as the session under it, not across the window. */
.pg-progress {
  display: flex;
  align-items: center;
  gap: var(--ds-size-4);
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--ds-size-6) var(--ds-size-8) 0;
}
.pg-progress:has(+ .pg-session--wide) { max-width: 1440px; }
.pg-progress > span { font-size: var(--ds-font-size-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-session {
  flex: 1 1 auto;
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--ds-size-8) var(--ds-size-8) var(--ds-size-14);
  display: flex;
  flex-direction: column;
  gap: var(--ds-size-6);
}
.pg-mode-nav { display: flex; align-items: center; gap: var(--ds-size-3); }
/* On a narrow screen the mode switcher scrolls inside itself instead of widening the page. */
.pg-mode-nav { min-width: 0; max-width: 100%; }
.pg-mode-nav > .ds-togglegroup { min-width: 0; }

.pg-flashcard {
  min-height: 420px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--ds-size-4);
  cursor: pointer;
  --dsc-card-padding: var(--ds-size-6) var(--ds-size-8);
}
.pg-flashcard { background: var(--ds-color-neutral-surface-default); width: 100%; }
.pg-flashcard[data-flipped="true"] { background: var(--ds-color-neutral-surface-tinted); }
.pg-flashcard-body { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: var(--ds-size-6) 0; }
.pg-front { max-width: 34ch; text-align: center; text-wrap: balance; font-size: var(--ds-font-size-8); font-weight: 500; line-height: 1.35; }
.pg-front .ds-paragraph, .pg-front .ds-list { font-size: inherit; line-height: inherit; }
.pg-front .ds-list { text-align: left; font-size: var(--ds-font-size-5); font-weight: 400; }
.pg-back { width: 100%; max-width: 62ch; font-size: var(--ds-font-size-4); line-height: 1.5; }
.pg-back .ds-paragraph, .pg-back .ds-list { font-size: inherit; line-height: inherit; }
.pg-flip-hint { display: flex; align-items: center; justify-content: center; gap: var(--ds-size-2); }
.pg-rate { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--ds-size-3); }
.pg-rate > .pg-wide { min-width: 220px; }

.pg-card-pad { --dsc-card-padding: var(--ds-size-8); display: flex; flex-direction: column; gap: var(--ds-size-4); align-items: flex-start; }
.pg-card-pad > * { margin-block: 0; }
.pg-prompt { font-size: var(--ds-font-size-6); line-height: 1.45; text-wrap: pretty; width: 100%; }
.pg-prompt .ds-paragraph { font-size: inherit; line-height: inherit; }

.pg-options { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--ds-size-3); }
.pg-options > legend { font-weight: 500; margin-bottom: var(--ds-size-3); padding: 0; }
.pg-option {
  display: flex;
  align-items: center;
  gap: var(--ds-size-4);
  width: 100%;
  min-height: 52px;
  padding: var(--ds-size-2) var(--ds-size-4);
  text-align: left;
  font: inherit;
  font-size: var(--ds-font-size-4);
  color: var(--ds-color-neutral-text-default);
  cursor: pointer;
  border-radius: var(--ds-border-radius-md);
  border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-default);
  background: var(--ds-color-neutral-surface-default);
}
.pg-option:hover:not([data-state]) { background: var(--ds-color-neutral-surface-hover); }
.pg-option[data-state] { cursor: default; }
.pg-option[data-state="correct"] { border: 2px solid var(--ds-color-success-border-strong); background: var(--ds-color-success-surface-tinted); }
.pg-option[data-state="wrong"] { border: 2px solid var(--ds-color-danger-border-strong); background: var(--ds-color-danger-surface-tinted); }
.pg-option > :nth-child(2) { flex: 1 1 auto; }
/* Question, answer and explanations (quiz, write, math, spreadsheet). One column in the
 * order of the markup: question, answer and Next, then the explanations. From 64rem: the
 * question with the explanations under it on the left, the answer on the right, so
 * answering adds to the left column and nothing on the right moves. */
.pg-qa { display: flex; flex-direction: column; gap: var(--ds-size-6); }
.pg-qa-answer, .pg-qa-why { display: flex; flex-direction: column; gap: var(--ds-size-6); min-width: 0; }
.pg-qa-answer > *, .pg-qa-why > * { margin-block: 0; }
.pg-qa-prompt { --dsc-card-padding: var(--ds-size-6); }
/* The question column opens with a label like the answer column's ("Pick the answer"), at the
 * same spacing, so that in two columns the question box and the first answer box start level. */
div.pg-qa-prompt { display: flex; flex-direction: column; gap: var(--ds-size-3); min-width: 0; }
div.pg-qa-prompt > .ds-label { font-weight: 500; }
@media (width >= 64rem) {
  .pg-session:has(> .pg-qa) { max-width: 1280px; }
  .pg-progress:has(+ .pg-session > .pg-qa) { max-width: 1280px; }
  .pg-qa {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "prompt answer" "why answer";
    column-gap: var(--ds-size-8);
    row-gap: var(--ds-size-6);
    align-items: start;
  }
  .pg-qa-prompt { grid-area: prompt; }
  .pg-qa-answer { grid-area: answer; }
  .pg-qa-why { grid-area: why; }
  /* The sheet needs the room: the task and its marking get the narrower column. */
  .pg-qa--sheet { grid-template-columns: minmax(17rem, 1fr) minmax(0, 2.4fr); }
  .pg-session:has(> .pg-qa--sheet), .pg-progress:has(+ .pg-session > .pg-qa--sheet) { max-width: 1440px; }
}
.pg-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-size-4); }
.pg-feedback > .ds-alert { flex: 1 1 360px; }
.pg-why { display: flex; flex-direction: column; gap: var(--ds-size-3); --dsc-card-padding: var(--ds-size-6); }
.pg-why > * { margin-block: 0; }
.pg-missed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--ds-size-3); }
.pg-missed > li { display: flex; flex-direction: column; gap: var(--ds-size-2); --dsc-card-padding: var(--ds-size-4); }
.pg-missed > li > * { margin-block: 0; }
/* A card whose direct child is a details element loses its padding (Designsystemet lays
 * such a card out in blocks). Give the text above the details its padding back; the
 * details keeps running edge to edge, as it does in a card. */
.pg-missed > li.ds-card:has(> .ds-details) { padding: var(--ds-size-4) 0 0; }
.pg-missed > li.ds-card:has(> .ds-details) > :not(.ds-details) { padding-inline: var(--ds-size-4); }

/* Write */
.pg-write { display: flex; flex-direction: column; gap: var(--ds-size-3); }
.pg-write > label { font-weight: 500; }
.pg-write input { flex: 1 1 360px; font-size: var(--ds-font-size-5); height: var(--ds-size-14); }
.pg-write-result { display: flex; flex-direction: column; gap: var(--ds-size-2); }

/* Match */
.pg-match-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--ds-size-4); }
.pg-match-head h2 { margin: 0; }
.pg-match-head > .pg-stack { flex: 1 1 0; min-width: 280px; }
.pg-match-stats { display: flex; align-items: center; gap: var(--ds-size-6); }
.pg-match-stats > div { display: flex; flex-direction: column; align-items: flex-end; }
.pg-stat { display: inline-flex; align-items: center; gap: var(--ds-size-2); font-size: var(--ds-font-size-6); font-weight: 500; }
.pg-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ds-size-3); }
.pg-tile {
  position: relative;
  min-height: 132px;
  padding: var(--ds-size-8) var(--ds-size-4) var(--ds-size-4);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font: inherit;
  font-size: var(--ds-font-size-3);
  line-height: 1.35;
  color: var(--ds-color-neutral-text-default);
  cursor: pointer;
  border-radius: var(--ds-border-radius-lg);
  border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-default);
  background: var(--ds-color-neutral-surface-default);
}
.pg-tile[data-kind="term"] { font-size: var(--ds-font-size-5); font-weight: 500; }
.pg-tile:hover:not([data-state]) { background: var(--ds-color-neutral-surface-hover); }
.pg-tile[data-state="selected"] { border: 2px solid var(--ds-color-accent-border-strong); background: var(--ds-color-accent-surface-tinted); }
.pg-tile[data-state="miss"] { border: 2px solid var(--ds-color-danger-border-strong); background: var(--ds-color-danger-surface-tinted); }
.pg-tile[data-state="gone"] { visibility: hidden; }
.pg-tile-key { position: absolute; top: var(--ds-size-3); left: var(--ds-size-3); display: flex; line-height: 1; font-size: var(--ds-font-size-3); font-weight: 400; }

/* Essay trainer */
.pg-levels { display: flex; flex-direction: column; gap: var(--ds-size-2); }
.pg-level {
  display: flex;
  align-items: center;
  gap: var(--ds-size-3);
  text-align: left;
  font: inherit;
  cursor: pointer;
  border-color: var(--ds-color-neutral-border-subtle);
  background: var(--ds-color-neutral-surface-default);
  --dsc-card-padding: var(--ds-size-3);
}
.pg-level[aria-pressed="true"] { border-color: var(--ds-color-accent-border-strong); background: var(--ds-color-accent-surface-tinted); }
.pg-level:disabled { cursor: default; opacity: 0.6; }
.pg-level-n, .pg-steps li > span:first-child {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75em;
  height: 1.75em;
  border-radius: var(--ds-border-radius-full);
  border: 1px solid var(--ds-color-neutral-border-default);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pg-level-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.pg-level-text > :first-child { font-weight: 500; }
.pg-level-text > :last-child { font-size: var(--ds-font-size-2); color: var(--ds-color-neutral-text-subtle); line-height: 1.4; }
/* Where a planned topic is written from, under its description. */
.pg-plan-pages { display: block; margin-top: var(--ds-size-1); }

/* relative: the hidden "locked" texts are absolutely placed, and must scroll with the bar, not widen the page. */
.pg-steps-bar { position: relative; padding: var(--ds-size-3) var(--ds-size-8); border-bottom: 1px solid var(--ds-color-neutral-border-subtle); overflow-x: auto; }
.pg-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--ds-size-6); font-size: var(--ds-font-size-2); white-space: nowrap; }
.pg-steps li { display: inline-flex; align-items: center; gap: var(--ds-size-2); color: var(--ds-color-neutral-text-subtle); }
.pg-steps li[data-state="current"] { color: var(--ds-color-neutral-text-default); font-weight: 500; }
.pg-steps li[data-state="current"] > span:first-child { background: var(--ds-color-accent-base-default); border-color: var(--ds-color-accent-base-default); color: var(--ds-color-accent-base-contrast-default); }
.pg-steps li[data-state="done"] > span:first-child { border-color: var(--ds-color-success-border-strong); background: var(--ds-color-success-surface-tinted); color: var(--ds-color-success-text-default); }
/* Locked: a dashed ring, not faded text, so the name keeps its contrast. */
.pg-steps li[data-state="locked"] > span:first-child { border-style: dashed; }

.pg-wait { align-items: center; text-align: center; padding-block: var(--ds-size-10); }
.pg-incident { display: flex; flex-direction: column; gap: var(--ds-size-3); background: var(--ds-color-neutral-surface-default); --dsc-card-padding: var(--ds-size-6); }
.pg-incident > * { margin-block: 0; }
.pg-incident-text { display: flex; flex-direction: column; gap: var(--ds-size-4); line-height: 1.7; }
.pg-incident-text > p { margin: 0; line-height: inherit; }
.pg-sentence {
  display: inline;
  font: inherit;
  color: inherit;
  text-align: left;
  padding: 2px 3px;
  margin: 0 -3px;
  border: none;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.pg-sentence:hover { background: var(--ds-color-neutral-surface-hover); }
.pg-sentence[data-state="marked"], .pg-ev { background: var(--ds-color-accent-surface-tinted); box-shadow: inset 0 -2px 0 var(--ds-color-accent-border-strong); }
.pg-ev { color: inherit; padding: 2px 3px; margin: 0 -3px; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.pg-ev[data-state="hit"] { background: var(--ds-color-success-surface-tinted); box-shadow: inset 0 -2px 0 var(--ds-color-success-border-strong); }
.pg-ev[data-state="missed"] { background: var(--ds-color-warning-surface-tinted); box-shadow: inset 0 -2px 0 var(--ds-color-warning-border-strong); }
.pg-ev[data-state="wrong"] { background: var(--ds-color-danger-surface-tinted); box-shadow: inset 0 -2px 0 var(--ds-color-danger-border-strong); }
.pg-sentence sup, .pg-ev sup, .pg-keyline sup { font-family: var(--dvk-font-mono); font-size: 0.7em; font-weight: 500; margin-left: 2px; }
.pg-keyline { font-size: var(--ds-font-size-2); font-weight: 500; }
.pg-check-row { display: flex; align-items: center; gap: var(--ds-size-3); --dsc-card-padding: var(--ds-size-4); }

.pg-session--wide { max-width: 1440px; }
.pg-write-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--ds-size-8); align-items: start; }
.pg-write-side { position: sticky; top: var(--ds-size-4); max-height: calc(100vh - var(--ds-size-8)); overflow: auto; }
.pg-write-main { display: flex; flex-direction: column; gap: var(--ds-size-4); }
.pg-editor { width: 100%; min-height: 26rem; resize: vertical; font-size: var(--ds-font-size-4); line-height: 1.6; padding: var(--ds-size-4); }
.pg-score { font-size: var(--ds-font-size-9); font-weight: 500; line-height: 1.1; }
.pg-criterion { display: flex; flex-direction: column; gap: var(--ds-size-2); --dsc-card-padding: var(--ds-size-4); }
.pg-criterion > * { margin-block: 0; }
.pg-quote { margin: 0; padding: var(--ds-size-2) var(--ds-size-3); border-radius: var(--ds-border-radius-md); background: var(--ds-color-neutral-surface-tinted); font-size: var(--ds-font-size-2); font-style: italic; }
.pg-yours { padding-top: var(--ds-size-3); }

@media (width < 64rem) {
  .pg-write-grid { grid-template-columns: minmax(0, 1fr); }
  .pg-write-side { position: static; max-height: none; }
}

@media (width < 40rem) {
  .pg-header, .pg-tabs, .pg-progress, .pg-footer, .pg-steps-bar { padding-inline: var(--ds-size-4); }
  .pg-library, .pg-session, .pg-deck { padding: var(--ds-size-4); }
  .pg-legal { padding: var(--ds-size-6) var(--ds-size-4) var(--ds-size-10); }
  .pg-search { margin-left: 0; }
  .pg-header > .pg-brand:has(+ .pg-session-title, + a.ds-button, + .pg-crumbs) { border-right: 0; padding-right: 0; margin-right: 0; }
  .pg-ask-form input[type="file"] { max-width: 100%; min-width: 0; }
  .pg-ask-form .pg-row > .pg-stack { min-width: 0; max-width: 100%; }
  .pg-flashcard { min-height: 320px; --dsc-card-padding: var(--ds-size-4); }
  .pg-front { font-size: var(--ds-font-size-5); }
  .pg-card-pad { --dsc-card-padding: var(--ds-size-4); }
  .pg-rate > .pg-wide { min-width: 0; flex: 1 1 140px; }
  .pg-footer { display: none; }
  .pg-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-tile { min-height: 104px; }
}

/* The brand is a link home. */
a.pg-brand { color: inherit; text-decoration: none; }


/* The landing page, for visitors who are not logged in. */
.pg-landing { width: 100%; max-width: 1200px; box-sizing: border-box; margin: 0 auto; padding: var(--ds-size-12) var(--ds-size-8); display: flex; flex-direction: column; gap: var(--ds-size-12); }
.pg-landing-hero { display: flex; flex-direction: column; gap: var(--ds-size-8); }
.pg-landing-hero-text { display: flex; flex-direction: column; gap: var(--ds-size-5); max-width: 46rem; }
.pg-landing-hero-text .ds-paragraph { color: var(--ds-color-neutral-text-subtle); }
/* From 64rem the opening text and the quiz picture side by side. */
@media (width >= 64rem) {
  .pg-landing-hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; }
}
/* A screenshot of Pugg itself: framed like a card, at most its own width. */
.pg-landing-shot { display: block; width: 100%; height: auto; max-width: 1200px; border: 1px solid var(--ds-color-neutral-border-subtle); border-radius: var(--ds-border-radius-lg); }
.pg-landing section.pg-stack { gap: var(--ds-size-4); }
.pg-landing-steps, .pg-landing-modes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--ds-size-4); }
.pg-landing-steps { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.pg-landing-steps > li { display: flex; flex-direction: column; gap: var(--ds-size-2); }
.pg-landing-step { display: inline-flex; align-items: center; justify-content: center; width: var(--ds-size-8); height: var(--ds-size-8); border-radius: 50%; background: var(--ds-color-accent-surface-tinted); color: var(--ds-color-accent-text-default); font-weight: 600; }
.pg-lang-switch { display: flex; align-items: center; gap: var(--ds-size-2); margin-right: var(--ds-size-3); color: var(--ds-color-neutral-text-subtle); }
.pg-lang-switch a[aria-current] { text-decoration: none; color: var(--ds-color-neutral-text-default); font-weight: 500; }
.pg-landing-modes { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pg-landing-modes > li { display: flex; align-items: flex-start; gap: var(--ds-size-3); }
.pg-landing-mode { font-weight: 500; }
.pg-landing-price { display: flex; flex-direction: column; align-items: flex-start; gap: var(--ds-size-3); max-width: 32rem; }
.pg-landing-amount { margin: 0; font-size: var(--ds-font-size-6); }
.pg-landing-amount .pg-num { font-weight: 600; }
/* On a phone the opening section has the same button, and the header has no room for it. */
@media (max-width: 40rem) { .pg-landing { padding: var(--ds-size-6) var(--ds-size-4); gap: var(--ds-size-8); } .pg-landing-header-start { display: none; } }

/* Home: the prompt and the list of subjects. */
.pg-home {
  flex: 1 1 auto;
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--ds-size-10) var(--ds-size-8);
  display: flex;
  flex-direction: column;
  gap: var(--ds-size-14);
}
/* The home page, from 64rem and once there are subjects: Today's 12 on the left and a new
 * subject on the right, the subjects under both, as many cards to a row as fit. Without
 * Today's 12 the new subject takes the top row alone. One column below 64rem, or with no
 * subjects yet, in the order of the markup. */
@media (width >= 64rem) {
  .pg-home:has(> .pg-ask):has(.pg-subjects > li) {
    max-width: 1280px;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-rows: auto auto;
    grid-template-areas: "daily ask" "subjects subjects";
    gap: var(--ds-size-14) var(--ds-size-8);
    align-items: start;
  }
  .pg-home:has(> .pg-ask):has(.pg-subjects > li):not(:has(> .pg-daily)) { grid-template-areas: "ask ask" "subjects subjects"; }
  /* Back from Stripe's checkout, a notice across the top. */
  .pg-home:has(> .pg-ask):has(.pg-subjects > li):has(> .pg-home-notice) { grid-template-rows: auto auto auto; grid-template-areas: "notice notice" "daily ask" "subjects subjects"; }
  .pg-home:has(> .pg-ask):has(.pg-subjects > li):has(> .pg-home-notice):not(:has(> .pg-daily)) { grid-template-areas: "notice notice" "ask ask" "subjects subjects"; }
  .pg-home > .pg-home-notice { grid-area: notice; }
  .pg-home > .pg-daily { grid-area: daily; }
  .pg-home > .pg-ask { grid-area: ask; }
  .pg-home > .pg-ask ~ section:not(.pg-ask) { grid-area: subjects; }
}
.pg-ask { align-items: stretch; }
.pg-ask-form { display: flex; flex-direction: column; gap: var(--ds-size-4); width: 100%; }
.pg-ask-text { width: 100%; min-height: 8rem; resize: vertical; line-height: 1.5; }
.pg-ask-text--small { min-height: 4.5rem; }
.pg-ask-form .pg-row--between { align-items: flex-end; }

/* Reviewing what the language model suggests for a deck: a change as two cards side by
   side (now, suggested), removals and additions in a grid; an item's body as its fields. */
.pg-revision { gap: var(--ds-size-10); }
.pg-revision-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr)); gap: var(--ds-size-4); align-items: stretch; }
.pg-revision-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr)); gap: var(--ds-size-4); }
.pg-revision-item { display: flex; flex-direction: column; gap: var(--ds-size-3); min-width: 0; --dsc-card-padding: var(--ds-size-5); }
.pg-revision-what { font-weight: 500; overflow-wrap: anywhere; }
.pg-revision-note { margin: 0; }
.pg-fields { margin: 0; display: grid; grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr); gap: var(--ds-size-1) var(--ds-size-3); font-size: var(--ds-font-size-2); }
.pg-fields > dt { color: var(--ds-color-neutral-text-subtle); }
.pg-fields > dd { margin: 0; min-width: 0; }
.pg-field-list { margin: 0; padding-left: var(--ds-size-5); display: flex; flex-direction: column; gap: var(--ds-size-2); }
.pg-field-text { white-space: pre-line; overflow-wrap: anywhere; }
.pg-subjects { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--ds-size-4); }
.pg-subject-card { display: flex; flex-direction: column; gap: var(--ds-size-2); height: 100%; box-sizing: border-box; color: inherit; text-decoration: none; --dsc-card-padding: var(--ds-size-6); }
.pg-subject-card:hover { border-color: var(--ds-color-neutral-border-strong); }
.pg-subject-title { font-size: var(--ds-font-size-5); font-weight: 500; line-height: 1.3; }

/* The plan the learner confirms before a subject is generated. */
.pg-plan { display: flex; flex-direction: column; gap: var(--ds-size-8); }
.pg-plan-title { font-size: var(--ds-font-size-7); font-weight: 600; height: auto; padding-block: var(--ds-size-2); }
.pg-plan-row { display: flex; flex-direction: row; align-items: center; gap: var(--ds-size-4); cursor: pointer; --dsc-card-padding: var(--ds-size-4); }
.pg-plan-row > input { flex-shrink: 0; }

/* "Extend this subject", under the deck table. */
.pg-extend { align-items: stretch; --dsc-card-padding: var(--ds-size-6); }

@media (width < 40rem) {
  .pg-home { padding: var(--ds-size-4); }
}

/* The spreadsheet mode: a small sheet with open cells to type formulas in. */
.pg-sheet { border-collapse: collapse; width: 100%; font-size: var(--ds-font-size-3); }
.pg-sheet th, .pg-sheet td { border: 1px solid var(--ds-color-neutral-border-subtle); padding: var(--ds-size-2) var(--ds-size-3); text-align: left; vertical-align: top; min-width: 5.5rem; }
.pg-sheet thead th, .pg-sheet thead td, .pg-sheet tbody th { background: var(--ds-color-neutral-surface-tinted); color: var(--ds-color-neutral-text-subtle); font-weight: 500; text-align: center; min-width: 2.5rem; width: 2.5rem; }
.pg-sheet-number { text-align: right !important; }
.pg-sheet-open { padding: var(--ds-size-1) !important; min-width: 11rem !important; background: var(--ds-color-neutral-surface-tinted); }
.pg-sheet-open > input { width: 100%; }
.pg-sheet-value { display: block; padding: var(--ds-size-1) var(--ds-size-2) 0; text-align: right; font-size: var(--ds-font-size-2); color: var(--ds-color-neutral-text-subtle); }
/* The files chosen in a drop zone (pugg.js), above the input that covers the zone. */
.ds-file-upload > .pg-chosen { font-weight: 500; overflow-wrap: anywhere; }

/* Like a spreadsheet: a cell that is not being edited shows its value in place of its
   formula; while it is edited, the formula, with the value it gives under it. */
.pg-sheet-open { position: relative; }
.pg-sheet-open:not(:focus-within):has(> .pg-sheet-value[data-kind="value"]) > input { color: transparent; }
.pg-sheet-open:not(:focus-within) > .pg-sheet-value[data-kind="value"] {
  position: absolute; inset: var(--ds-size-1); display: flex; align-items: center; justify-content: flex-end;
  padding: 0 var(--ds-size-3); font-size: inherit; color: var(--ds-color-neutral-text-default); pointer-events: none;
}
/* The cells the formula being typed refers to (mode.js). */
.pg-sheet td[data-referenced] { box-shadow: inset 0 0 0 2px var(--ds-color-accent-border-strong); }
.pg-sheet-open[data-state="right"] { outline: 2px solid var(--ds-color-success-border-default); outline-offset: -2px; }
.pg-sheet-open[data-state="typed"] { outline: 2px solid var(--ds-color-warning-border-default); outline-offset: -2px; }
.pg-sheet-open[data-state="wrong"], .pg-sheet-open[data-state="empty"] { outline: 2px solid var(--ds-color-danger-border-default); outline-offset: -2px; }

/* The lines of a worked solution. */
.pg-steps-list { margin: 0; padding-left: var(--ds-size-6); display: flex; flex-direction: column; gap: var(--ds-size-1); font-size: var(--ds-font-size-3); line-height: 1.5; }

/* A verdict on one answer: the tag, then the text beside it. */
.pg-missed > li.pg-check-row { flex-direction: row; align-items: flex-start; }
.pg-check-row > .ds-tag { flex-shrink: 0; }

/* The topics on a deck page: a label and a row of chips, without a frame of its own. */
.pg-topics { display: flex; flex-direction: column; gap: var(--ds-size-1); margin-bottom: var(--ds-size-2); }
.pg-topics .pg-chips { padding-top: 0; }
.pg-topics-label { font-weight: 400; font-size: var(--ds-font-size-3); }
.pg-topics summary { cursor: pointer; list-style-position: inside; }
.pg-topics details[open] summary { margin-bottom: var(--ds-size-2); }

/* What the next round will bring, above a block's Start button. */
.pg-mix { margin: 0; }

/* The profile page. */
.pg-activity { align-items: stretch; }
.pg-chart { display: flex; align-items: flex-end; gap: 2px; height: 8rem; }
.pg-chart-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; }
.pg-chart-col:hover .pg-chart-bar { opacity: 0.75; }
.pg-chart-bar { width: 100%; min-height: 0; border-radius: 4px 4px 0 0; background: var(--ds-color-accent-base-default); }
.pg-chart-bar--empty { height: 2px !important; min-height: 2px; border-radius: 1px; background: var(--ds-color-neutral-border-subtle); }
.pg-chart-axis { display: flex; justify-content: space-between; }
.pg-profile-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: var(--ds-size-4); }
.pg-profile-pair > .ds-card { align-items: stretch; }
.pg-profile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-self: stretch; }
.pg-profile-list > li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--ds-size-4); padding: var(--ds-size-2) 0; border-bottom: 1px solid var(--ds-color-neutral-border-subtle); }
.pg-profile-list > li:last-child { border-bottom: none; }
/* A connected browser on the profile: its name over when it was connected and last used. */
.pg-profile-list > li.pg-extension-row { align-items: center; }
.pg-extension-browser { display: flex; flex-direction: column; gap: var(--ds-size-1); min-width: 0; }
.pg-profile-nemesis { flex-direction: column; align-items: flex-start !important; gap: var(--ds-size-1) !important; }
.pg-stats--four { grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr)); }

/* Today's 12 on the home page: one row per subject. */
.pg-daily { align-items: stretch; }
.pg-daily-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pg-daily-list > li { display: grid; grid-template-columns: minmax(0, 1fr) 8rem 10rem; align-items: center; gap: var(--ds-size-4); padding: var(--ds-size-3) 0; border-top: 1px solid var(--ds-color-neutral-border-subtle); }
.pg-daily-list .ds-button { width: 100%; }
.pg-daily-text { gap: var(--ds-size-1); min-width: 0; }
.pg-daily-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 40rem) { .pg-daily-list > li { grid-template-columns: minmax(0, 1fr) auto; } .pg-daily-bar { display: none; } }

