/* Learn It With Me — the standard theme.
   ======================================================================
   One set of colour and font tokens for every page (hub pages and interactives), in a light and a
   dark version. Loaded first by includes/site.php, so a page's own stylesheet only adds tokens for
   its own diagrams (see THEME-TOKENS.md).

   Which version shows:
     - by default, the computer's own setting (prefers-color-scheme)
     - or what the person picked with the light/dark switch in the header, which sets
       <html data-theme="light|dark"> (js/theme.js; remembered in this browser)

   The three selectors below are the ones every page's own stylesheet uses too, so page tokens
   switch in step:  :root  ·  @media (prefers-color-scheme: dark) :root:not([data-theme="light"])  ·  :root[data-theme="dark"]

   Colours are chosen for WCAG AA contrast: ink, ink-soft and muted text all reach at least 4.5:1
   on both paper and panel, in both versions.
*/

:root {
  color-scheme: light;

  /* surfaces */
  --paper: #EEF2F5;          /* page background */
  --panel: #FFFFFF;          /* cards, panels, dialogs */
  --panel-2: #F5F8FA;        /* a panel inside a panel */

  /* text */
  --ink: #13202B;
  --ink-soft: #3F5163;
  --muted: #5B6B7B;

  /* lines */
  --line: #D6DEE5;
  --line-strong: #B4C2CE;

  /* brand accents (the logo's blue and orange) */
  --accent: #1A67AD;
  --accent-deep: #0B2A52;
  --accent-tint: #E2EDF8;
  --on-accent: #FFFFFF;      /* text on an --accent background */
  --accent-b: #B35716;
  --accent-b-deep: #7E3B0C;
  --accent-b-tint: #FBEBDD;

  /* status */
  --ok: #2B7A4B;
  --ok-tint: #E0F1E7;
  --warn: #8A5D00;
  --warn-tint: #FFF1D1;
  --bad: #B3261E;
  --bad-tint: #FBE3E1;
  --hint: #5A48B0;
  --hint-tint: #ECE9FB;
  --active: #7C3AAE;         /* in-progress working-out steps */
  --active-tint: #F2E8FB;

  --focus: #1A67AD;
  --brand-grey: #6D6E71;
  --logo-plate: transparent;
  --logo-pad: 0px;
  --school-logo-plate: transparent;  /* behind a school's own logo (Branding): most are made for white */
  --radius: 8px;
  --shadow: 0 1px 2px rgba(19, 32, 43, .06), 0 8px 24px -16px rgba(19, 32, 43, .28);

  /* fixed brand colours, the same in both versions (for white text on colour: banners, icons) */
  --brand-navy: #0B2A52;
  --brand-blue: #1D6FB8;
  --brand-orange: #E07A2C;
  --brand-green: #3F9142;

  /* ---- colours for diagrams, charts and games (THEME-TOKENS.md, "Data and diagrams") ----
     --viz-1…8: categories, series and labelled parts, in this order; deep enough for text on --panel
     in light mode, bright on the dark panels. -tint: a background behind text; -area: a shaded region. */
  --viz-1: #2563EB;  /* blue */
  --viz-1-tint: rgba(37, 99, 235, .14);
  --viz-1-area: rgba(37, 99, 235, .34);
  --viz-2: #C2410C;  /* orange */
  --viz-2-tint: rgba(194, 65, 12, .14);
  --viz-2-area: rgba(194, 65, 12, .34);
  --viz-3: #15803D;  /* green */
  --viz-3-tint: rgba(21, 128, 61, .14);
  --viz-3-area: rgba(21, 128, 61, .34);
  --viz-4: #7C3AED;  /* purple */
  --viz-4-tint: rgba(124, 58, 237, .14);
  --viz-4-area: rgba(124, 58, 237, .34);
  --viz-5: #DC2626;  /* red */
  --viz-5-tint: rgba(220, 38, 38, .14);
  --viz-5-area: rgba(220, 38, 38, .34);
  --viz-6: #0E7490;  /* teal */
  --viz-6-tint: rgba(14, 116, 144, .14);
  --viz-6-area: rgba(14, 116, 144, .34);
  --viz-7: #A16207;  /* gold */
  --viz-7-tint: rgba(161, 98, 7, .14);
  --viz-7-area: rgba(161, 98, 7, .34);
  --viz-8: #DB2777;  /* pink */
  --viz-8-tint: rgba(219, 39, 119, .14);
  --viz-8-area: rgba(219, 39, 119, .34);
  --on-viz: #FFFFFF;   /* text on a solid --viz-n */
  /* a sequential scale, low → high (heat maps, choropleths): the high end stands out most from the page */
  --seq-1: #DBEAFE;
  --seq-2: #93C5FD;
  --seq-3: #3B82F6;
  --seq-4: #1D4ED8;
  --seq-5: #1E3A8A;

  /* these point at the tokens above (or the theme's own), so they follow the mode and every theme */
  --chart-bg: var(--panel);  --chart-ink: var(--ink);  --chart-ink-soft: var(--ink-soft);  --chart-label: var(--muted);
  --chart-axis: var(--ink-soft);  --chart-grid: var(--line);  --chart-grid-strong: var(--line-strong);  --chart-highlight: var(--accent);
  /* economics graphs: demand red, supply blue, a new or world curve green, a set price gold, the social curves purple and teal */
  --curve-demand: var(--viz-5);  --curve-supply: var(--viz-1);  --curve-shift: var(--viz-3);  --curve-world: var(--viz-3);
  --curve-price: var(--viz-7);  --curve-social-benefit: var(--viz-4);  --curve-social-cost: var(--viz-6);
  --area-consumer: var(--viz-1-area);  --area-producer: var(--viz-7-area);  --area-government: var(--viz-3-area);
  --area-deadweight: var(--viz-5-area);  --area-gap: var(--viz-4-area);
  /* a game screen that stays dark in both modes, like a display (Hexa-Tac, Pixel Painter, the arcade games) */
  --screen-bg: #05080F;  --screen-panel: #0B1324;  --screen-line: #2A3241;  --screen-ink: #E6EDF3;  --screen-muted: #94A3B8;
  --neon-blue: #60A5FA;  --neon-cyan: #22D3EE;  --neon-green: #34D399;  --neon-amber: #FBBF24;
  --neon-red: #F87171;  --neon-purple: #A78BFA;  --neon-pink: #F472B6;

  /* type */
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-cjk: "Source Sans 3", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", "Malgun Gothic", sans-serif;

  /* phase 2: it-systems */
  --map-sea: #DBE9F5;    /* a map's sea (GPS Triangulator) */
  --map-land: #EEF3E2;   /* a map's land */
  --map-coast: #7D9A6A;  /* a coastline, a border on a map */
  /* phase 2: games (a game screen's colours are the same in both modes, like the other --neon-* tokens, so no
     dark-mode copy) */
  --neon-orange: #FB923C;   /* a glowing orange, for a game that needs it beside --neon-amber (the arcade games) */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0E151C;
    --panel: #151F29;
    --panel-2: #1B2733;
    --ink: #E6EDF3;
    --ink-soft: #B3C1CE;
    --muted: #93A3B2;
    --line: #2A3947;
    --line-strong: #3E5061;
    --accent: #5FAEEA;
    --accent-deep: #A6D0F2;
    --accent-tint: #132C42;
    --on-accent: #0E151C;
    --accent-b: #F0955A;
    --accent-b-deep: #F7BC92;
    --accent-b-tint: #3A2414;
    --ok: #6FC296;
    --ok-tint: #16301F;
    --warn: #E3B04B;
    --warn-tint: #3A2C10;
    --bad: #F08080;
    --bad-tint: #3B1A1A;
    --hint: #B0A4F2;
    --hint-tint: #262040;
    --active: #CDA3F4;
    --active-tint: #2E2140;
    --focus: #5FAEEA;
    --brand-grey: #A3ABB1;
    --logo-plate: transparent;
    --logo-pad: 0px;
    --school-logo-plate: #F4F6F8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .8);
    /* diagrams and charts, dark */
    --viz-1: #60A5FA;  /* blue */
    --viz-1-tint: rgba(96, 165, 250, .2);
    --viz-1-area: rgba(96, 165, 250, .32);
    --viz-2: #FB923C;  /* orange */
    --viz-2-tint: rgba(251, 146, 60, .2);
    --viz-2-area: rgba(251, 146, 60, .32);
    --viz-3: #4ADE80;  /* green */
    --viz-3-tint: rgba(74, 222, 128, .2);
    --viz-3-area: rgba(74, 222, 128, .32);
    --viz-4: #A78BFA;  /* purple */
    --viz-4-tint: rgba(167, 139, 250, .2);
    --viz-4-area: rgba(167, 139, 250, .32);
    --viz-5: #F87171;  /* red */
    --viz-5-tint: rgba(248, 113, 113, .2);
    --viz-5-area: rgba(248, 113, 113, .32);
    --viz-6: #22D3EE;  /* teal */
    --viz-6-tint: rgba(34, 211, 238, .2);
    --viz-6-area: rgba(34, 211, 238, .32);
    --viz-7: #FBBF24;  /* gold */
    --viz-7-tint: rgba(251, 191, 36, .2);
    --viz-7-area: rgba(251, 191, 36, .32);
    --viz-8: #F472B6;  /* pink */
    --viz-8-tint: rgba(244, 114, 182, .2);
    --viz-8-area: rgba(244, 114, 182, .32);
    --on-viz: #0E151C;
    --seq-1: #172554;
    --seq-2: #1E40AF;
    --seq-3: #3B82F6;
    --seq-4: #93C5FD;
    --seq-5: #DBEAFE;

    /* phase 2: it-systems */
    --map-sea: #10233A;    /* a map's sea (GPS Triangulator) */
    --map-land: #1F3326;   /* a map's land */
    --map-coast: #5F8A63;  /* a coastline, a border on a map */
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0E151C;
  --panel: #151F29;
  --panel-2: #1B2733;
  --ink: #E6EDF3;
  --ink-soft: #B3C1CE;
  --muted: #93A3B2;
  --line: #2A3947;
  --line-strong: #3E5061;
  --accent: #5FAEEA;
  --accent-deep: #A6D0F2;
  --accent-tint: #132C42;
  --on-accent: #0E151C;
  --accent-b: #F0955A;
  --accent-b-deep: #F7BC92;
  --accent-b-tint: #3A2414;
  --ok: #6FC296;
  --ok-tint: #16301F;
  --warn: #E3B04B;
  --warn-tint: #3A2C10;
  --bad: #F08080;
  --bad-tint: #3B1A1A;
  --hint: #B0A4F2;
  --hint-tint: #262040;
  --active: #CDA3F4;
  --active-tint: #2E2140;
  --focus: #5FAEEA;
  --brand-grey: #A3ABB1;
  --logo-plate: transparent;
  --logo-pad: 0px;
  --school-logo-plate: #F4F6F8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .8);
  /* diagrams and charts, dark */
  --viz-1: #60A5FA;  /* blue */
  --viz-1-tint: rgba(96, 165, 250, .2);
  --viz-1-area: rgba(96, 165, 250, .32);
  --viz-2: #FB923C;  /* orange */
  --viz-2-tint: rgba(251, 146, 60, .2);
  --viz-2-area: rgba(251, 146, 60, .32);
  --viz-3: #4ADE80;  /* green */
  --viz-3-tint: rgba(74, 222, 128, .2);
  --viz-3-area: rgba(74, 222, 128, .32);
  --viz-4: #A78BFA;  /* purple */
  --viz-4-tint: rgba(167, 139, 250, .2);
  --viz-4-area: rgba(167, 139, 250, .32);
  --viz-5: #F87171;  /* red */
  --viz-5-tint: rgba(248, 113, 113, .2);
  --viz-5-area: rgba(248, 113, 113, .32);
  --viz-6: #22D3EE;  /* teal */
  --viz-6-tint: rgba(34, 211, 238, .2);
  --viz-6-area: rgba(34, 211, 238, .32);
  --viz-7: #FBBF24;  /* gold */
  --viz-7-tint: rgba(251, 191, 36, .2);
  --viz-7-area: rgba(251, 191, 36, .32);
  --viz-8: #F472B6;  /* pink */
  --viz-8-tint: rgba(244, 114, 182, .2);
  --viz-8-area: rgba(244, 114, 182, .32);
  --on-viz: #0E151C;
  --seq-1: #172554;
  --seq-2: #1E40AF;
  --seq-3: #3B82F6;
  --seq-4: #93C5FD;
  --seq-5: #DBEAFE;

  /* phase 2: it-systems */
  --map-sea: #10233A;    /* a map's sea (GPS Triangulator) */
  --map-land: #1F3326;   /* a map's land */
  --map-coast: #5F8A63;  /* a coastline, a border on a map */
}

html { background: var(--paper); }

/* ---- the light/dark switch (header of every page) ---- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-width: 34px; padding: 0 9px;
  font: 600 13px/1 var(--font-body); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; flex: none; }

/* ---- the light/dark switch: a sun and a moon on the track, the thumb slides to the one in use ---- */
.theme-switch { display: inline-flex; align-items: center; padding: 0; background: none; border: 0; cursor: pointer; border-radius: 999px; }
.theme-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.theme-switch-track {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between;
  width: 58px; height: 30px; padding: 0 8px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--ink-soft);
  transition: background .2s, border-color .2s;
}
.theme-switch:hover .theme-switch-track { border-color: var(--accent); }
.theme-switch svg { position: relative; z-index: 1; width: 14px; height: 14px; flex: none; transition: color .2s; }
.theme-switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease;
}
.theme-switch .icon-sun { color: var(--on-accent); }                 /* light: thumb under the sun (data-bs-theme is set before the page draws) */
:root[data-bs-theme="dark"] .theme-switch-thumb { transform: translateX(28px); }
:root[data-bs-theme="dark"] .theme-switch .icon-sun { color: var(--ink-soft); }
:root[data-bs-theme="dark"] .theme-switch .icon-moon { color: var(--on-accent); }
@media (prefers-reduced-motion: reduce) { .theme-switch-thumb, .theme-switch-track, .theme-switch svg { transition: none; } }

/* ---- the brain watermark (every page, every theme except High contrast) ---- */
.liwm-watermark {
  position: fixed; left: 50%; top: 52%; z-index: 0; pointer-events: none;
  width: min(70vmin, 620px); aspect-ratio: 1; transform: translate(-50%, -50%);
  background: url(/img/liwm-mark.svg) center / contain no-repeat;
  opacity: .045;
}
:root[data-theme="dark"] .liwm-watermark { opacity: .06; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .liwm-watermark { opacity: .06; } }
@media print { .liwm-watermark, .liwm-decor, .liwm-decor-page { display: none !important; } }

/* ---- theme decorations (drawn by js/decor.js; each theme's css/themes/<key>.css styles them) ---- */
.liwm-decor { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.liwm-decor-page { position: absolute; left: 0; top: 0; width: 100%; height: 0; z-index: 3; pointer-events: none; }
.liwm-decor-page > *, .liwm-decor > * { pointer-events: none; }
.decor-p {
  position: absolute; top: -40px; left: var(--x, 50%); display: block;
  animation-duration: var(--d, 14s); animation-delay: var(--delay, 0s);
  animation-timing-function: linear; animation-iteration-count: infinite;
  scale: var(--s, 1);
}
/* ornaments at the page edges only where there's room beside the content */
@media (max-width: 1279px) { .decor-matariki, .decor-sun, .decor-blossom, .decor-lantern, .decor-fireworks, .decor-zodiac { display: none; } }
@media (max-width: 640px) { .decor-pumpkin { width: 56px !important; height: 50px !important; } }
/* animation off: the person's choice, their computer's reduce-motion setting, or while a game is played */
html.liwm-still .liwm-decor .decor-p, html.liwm-playing .liwm-decor .decor-p { display: none; }
html.liwm-still .liwm-decor-page *, html.liwm-still .liwm-decor * { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .liwm-decor .decor-p { display: none; }
  .liwm-decor-page *, .liwm-decor * { animation: none !important; }
}
.motion-toggle[hidden] { display: none; }

@keyframes liwm-fall  { from { transform: translate(0, -5vh) rotate(0); } 50% { transform: translate(var(--drift, 30px), 52vh) rotate(180deg); } to { transform: translate(0, 110vh) rotate(360deg); } }
@keyframes liwm-rise  { from { transform: translate(0, 110vh); opacity: 0; } 10% { opacity: .8; } 50% { transform: translate(var(--drift, 30px), 55vh); } to { transform: translate(0, -10vh); opacity: 0; } }
@keyframes liwm-drift { from { transform: translate(-12vw, 0); } 25% { transform: translate(28vw, -24px); } 50% { transform: translate(60vw, 10px); } 75% { transform: translate(90vw, -18px); } to { transform: translate(115vw, 0); } }
@keyframes liwm-twinkle { 0%, 100% { opacity: 0; } 50% { opacity: .9; } }
@keyframes liwm-glow  { 0%, 100% { opacity: .75; filter: drop-shadow(0 0 2px #9CC0FF); } 50% { opacity: 1; filter: drop-shadow(0 0 10px #CFE0FF); } }
@keyframes liwm-spin  { to { transform: rotate(360deg); } }
@keyframes liwm-waves { to { background-position: 200px 0; } }
@keyframes liwm-burst { 0% { transform: scale(.2); opacity: 0; } 15% { opacity: 1; } 60% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.1); opacity: 0; } }
@keyframes liwm-sway  { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* ---- the account avatar (initials, or the Google profile picture over them) and Subscribe, in every header ---- */
.avatar-link { position: relative; overflow: hidden; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none;
  font: 700 13px/1 var(--font-body); letter-spacing: .02em; color: #fff; text-decoration: none;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--line-strong); transition: box-shadow .15s; }
.avatar-link:hover, .avatar-link:focus-visible { color: #fff; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); outline: none; }
.avatar-link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-0 { background: var(--brand-blue); } .avatar-1 { background: var(--brand-green); }
.avatar-2 { background: var(--brand-orange); } .avatar-3 { background: var(--brand-navy); }
.subscribe-link { border-radius: 999px; padding-inline: .9rem; font-weight: 600; }

/* ---- a school's logo beside ours (from a custom theme) ---- */
.school-logo { height: 44px; max-width: 170px; width: auto; object-fit: contain; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); vertical-align: middle; }
.navbar-brand .school-logo { height: 48px; }
@media (max-width: 560px) { .school-logo { height: 32px; max-width: 110px; } }
/* a subscribed school's own logo and name (Branding), after the brain */
.school-brand-logo { border-left: 0; padding-left: 6px; background: var(--school-logo-plate); border-radius: 6px; padding: 2px 6px; box-sizing: content-box; }
.school-brand-name { margin-left: 10px; font-weight: 700; font-size: 1.05rem; line-height: 1.15; color: var(--ink); max-width: 16em; white-space: normal; vertical-align: middle; }
@media (max-width: 560px) { .school-brand-name { display: none; } }
.school-logo-preview { display: flex; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.school-logo-preview img { height: 56px; max-width: 260px; object-fit: contain; background: var(--school-logo-plate); border-radius: 6px; padding: 2px 6px; }

/* ---- page titles use the theme's title font (a decorative one never reaches buttons or labels) ---- */
:root h1, :root .display-5, body[data-page] h2 { font-family: var(--font-feature, var(--font-display)) !important; }

/* ---- the account menu behind the avatar (account_link(), js/account-menu.js) ---- */
.account-menu { position: relative; display: inline-flex; }
button.avatar-link { border: 0; padding: 0; cursor: pointer; font: inherit; }
/* the subscribed badge (account_link()): a small star over the avatar's bottom-right corner */
.avatar-subscribed { position: absolute; right: -4px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  background: var(--warn); color: var(--paper); box-shadow: 0 0 0 2px var(--paper); pointer-events: none; }
.avatar-subscribed svg { width: 11px; height: 11px; fill: currentColor; }
.account-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1050; width: min(290px, calc(100vw - 24px));
  max-height: calc(100vh - 90px); overflow: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow); text-align: left; }
.account-menu-panel[hidden] { display: none; }
.account-menu-panel hr { margin: 6px 4px; border-color: var(--line); opacity: 1; }
.account-menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 1px; font-size: 14px; line-height: 1.3; }
.account-menu-who span { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.account-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; padding: 7px 10px;
  border: 0; border-radius: 6px; background: none; color: var(--ink); font: 500 14.5px/1.3 var(--font-body); text-align: left; text-decoration: none; cursor: pointer; }
.account-menu-item:hover, .account-menu-item:focus-visible { background: var(--accent-tint); color: var(--ink); outline: none; }
.account-menu-item.is-text { color: var(--muted); cursor: default; }
.account-menu-item.is-text:hover { background: none; }
.account-menu-note { color: var(--muted); font-size: 12px; font-weight: 400; }
.account-sub-chev { color: var(--muted); font-size: 18px; line-height: 1; transition: transform .15s; }
.account-sub-btn[aria-expanded="true"] .account-sub-chev { transform: rotate(90deg); }
.account-sub-list { margin: 0 0 4px 12px; padding-left: 6px; border-left: 2px solid var(--line); }
.account-sub-list .account-menu-item { font-size: 14px; min-height: 36px; }
@media (prefers-reduced-motion: reduce) { .account-sub-chev { transition: none; } }

/* ---- shared resource furniture that pages without /css/resource.css use too (the older top bar
        pages: Logic Gate Deflector, the brain explorer): the Key Terms dialog, the top bar, the leaderboards ---- */
/* ---- the Key Terms dialog (key_terms_dialog() in includes/site.php) ---- */
#dlgTerms [lang="ko"]{word-break:keep-all}
#dlgTerms .terms-intro{font-size:.85rem;color:var(--muted);margin-top:0}
#dlgTerms .dialog-foot{padding:14px 18px;display:flex;justify-content:flex-end}

/* ---- the older top bar (topbar(): Logic Gate Deflector, the brain explorer) ---- */
.topbar .topbar-back{text-decoration:none}

/* ---- leaderboards (js/game-scores.js): the board tabs, a signed-in player's note, their row ---- */
.liwm-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:0 0 8px}
.liwm-tab{font:inherit;font-size:12px;line-height:1.3;padding:3px 10px;border:1px solid var(--line-strong);background:transparent;color:inherit;border-radius:999px;cursor:pointer}
.liwm-tab[aria-selected="true"]{background:var(--accent);border-color:var(--accent);color:#fff}
.liwm-tab:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.liwm-auto-note{flex-basis:100%;font-size:12px;opacity:.8;margin-top:4px}
.liwm-board-msg{font-size:12px;color:var(--muted)}
.liwm-your-best{font-size:12px;margin-top:6px;opacity:.85}
.leaderboard-table tr.liwm-you,tr.liwm-you{font-weight:700}
/* a schoolmate's code: their name on hover, or on tap (focus) on a phone */
.liwm-code{position:relative;cursor:help;text-decoration:underline dotted;text-underline-offset:3px;outline:none}
.liwm-code:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:3px}
.liwm-code:hover::after,.liwm-code:focus::after{content:attr(data-name);position:absolute;left:0;top:calc(100% + 4px);z-index:20;width:max-content;max-width:min(80vw,22rem);white-space:pre-line;overflow-wrap:anywhere;padding:3px 8px;border-radius:6px;background:var(--panel);color:var(--ink);border:1px solid var(--line-strong);box-shadow:var(--shadow);font-weight:400;letter-spacing:0;font-size:13px}

/* ---- a student's assigned work: the red alert by the avatar, and its dropdown (work_alert(), js/core.js) ----
   It pulses (once a second, gently) until it's opened; not at all for anyone who has asked for less motion. */
.work-alert { position: relative; display: inline-flex; }
.work-alert[hidden], .work-bar[hidden] { display: none; }
.work-alert-btn { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px 0 8px; border: 0; border-radius: 18px;
  background: var(--bad); color: #fff; font: 700 14px/1 var(--font-body); cursor: pointer; animation: work-pulse 1.4s ease-in-out infinite; }
.work-alert-btn svg { width: 18px; height: 18px; }
.work-alert-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.work-alert-btn[aria-expanded="true"], .work-alert.seen .work-alert-btn { animation: none; }
@keyframes work-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--bad) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .work-alert-btn { animation: none; } }
.work-alert-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1050; width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 90px); overflow: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow); text-align: left; }
.work-alert-panel[hidden] { display: none; }
@media (max-width: 480px) { .work-alert-panel { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; } }
.work-alert-head { padding: 6px 10px 4px; font-weight: 700; font-size: 15px; }
.work-alert-item { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.work-alert-item:hover, .work-alert-item:focus-visible { background: var(--panel-2); color: var(--ink); outline: none; }
.work-alert-item strong { display: block; font-size: 14px; }
.work-alert-meta { display: block; font-size: 12px; color: var(--muted); }
.work-alert-todo { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-soft); }
.work-have { color: var(--muted); }
.work-overdue { color: var(--bad); font-weight: 700; }
.work-alert-all { display: block; padding: 8px 10px 4px; border-top: 1px solid var(--line); font-size: 13px; }
