/* DEFEND YOUR ECOREGION. One page, drawn for three screens: the classroom projector (1920 and 1440 wide, read from the
   back of a room), and the teacher's phone (393 wide) when it is the thing running the lesson. Same tokens as
   school-pages.css so a teacher who steps from the teacher view has not changed rooms.

   SIZE IS ONE NUMBER. html.df-on sets the root size from the viewport width and every length below is rem. 1rem is 28px at
   1920 (the body text of a round, the smallest thing a pupil has to read from the back of the room), about 25px at 1440 and
   17px on a phone, without a media query for each rule. The cap is 30px: past that a line is longer than a person can follow.

   COLOUR NEVER CARRIES THE MEANING. An outcome is a word and a mark (best supported by the evidence, partly supported, least supported), a
   species' status is its IUCN letters as well as its colour, and the region health is a number and ten segments as well as a
   fill. Every control is at least 56px tall, because it is tapped on a phone and clicked from a clicker.

   MOTION IS DECORATION. prefers-reduced-motion switches off the map's push-in, the meter's stagger, the suspense beat, the
   particles and the flight footage's autoplay; the page says the same things, a moment sooner, standing still. */
/* THE LANGUAGE BUTTON IS THE ONE CONTROL THIS PAGE DID NOT DRAW. i18n.css sizes it for a nav bar (27px tall), and on a phone it was the
   only button here under 44px: test/defend.e2e.mjs measured it at 26.8px in WebKit and Chromium, and passed only while it had not yet
   been inserted, which made the check a race instead of a rule. The page's promise is that every control is tapped or clicked from a
   clicker, so it gets the same floor as the rest. */
html.df-on .i18n-btn { min-height: 44px; }


:root { --bad: #E59A8A; --glow: rgba(201, 165, 92, .35); --card: #131a12; }
/* rem, not px: `rem` on the root element is the browser's own default size, so a person who sets a larger default text size (the browser's
   own setting, WCAG 1.4.4) gets a larger page. In px this clamp ignored that setting. Same numbers at the usual 16px default. */
html.df-on { font-size: clamp(1rem, calc(0.72vw + .8875rem), 1.875rem); }
html.df-on body { font: 400 1rem/1.5 var(--serif); }
.df-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.df-root[hidden] { display: none; }
.df-root { min-height: 100vh; display: flex; flex-direction: column; padding: .8rem clamp(.9rem, 3vw, 2.4rem) 2rem; max-width: 110rem; margin: 0 auto;
  background: radial-gradient(60rem 30rem at 85% -5%, rgba(143, 201, 168, .07), transparent 70%), radial-gradient(50rem 28rem at 0% 0%, rgba(201, 165, 92, .08), transparent 70%); }
html:not(.df-on) .df-root { display: none; }
.df-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.df-top { display: flex; align-items: center; gap: .4rem 1.2rem; flex-wrap: wrap; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.df-brand { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; font: 700 .72rem/1 var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); text-decoration: none; }
.df-brand span { color: var(--ink); margin-left: .6rem; }
.df-where { margin: 0; flex: 1 1 8rem; min-width: 0; font: 600 .72rem/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 79.99rem) { .df-where { white-space: normal; overflow-wrap: anywhere; } }
.df-tools { display: flex; flex-wrap: wrap; gap: .3rem .5rem; }
.df-tool { display: inline-flex; align-items: center; gap: .4rem; font: 600 .72rem/1 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--dim);
  background: none; border: 1.5px solid transparent; border-radius: 999px; padding: .5rem .8rem; min-height: 44px; cursor: pointer; text-decoration: none; }
.df-tool:hover { color: var(--ink); border-color: var(--line); }
.df-tool[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.df-ic { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

#main { flex: 1; padding-top: 1rem; outline: none; }
.df-screen[hidden] { display: none; }
.df-kicker { font: 700 .72rem/1.3 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 0 0 .5rem; }
.df-h1 { font: 800 clamp(2rem, 3.4vw, 3.4rem)/1.05 var(--ui); letter-spacing: -.025em; margin: 0 0 .7rem; text-wrap: balance; outline: none; }
.df-h1.df-sm { font-size: clamp(1.6rem, 2.4vw, 2.4rem); }
.df-h2 { font: 700 1.1rem/1.2 var(--ui); margin: 0 0 .5rem; }
.df-h3 { font: 700 .72rem/1.3 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin: 0 0 .6rem; }
.df-lede { font-size: 1.2rem; line-height: 1.42; color: var(--dim); max-width: 40rem; margin: 0 0 1rem; }
.df-note { font-size: .85rem; line-height: 1.45; color: var(--dim); margin: 0 0 .6rem; }
.df-hint { font: 500 .8rem/1.4 var(--ui); color: var(--dim); margin: .8rem 0 0; }
.df-meta { font: 600 .8rem/1.3 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--green); margin: 0 0 .8rem; }
.df-keys { display: none; }
@media (hover: hover) and (min-width: 52rem) { .df-keys { display: block; } }

.df-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 3.5rem; padding: .6rem 1.6rem; border-radius: 999px;
  border: 1.5px solid var(--gold); background: transparent; color: var(--ink); font: 700 .85rem/1 var(--ui); letter-spacing: .09em;
  text-transform: uppercase; text-decoration: none; cursor: pointer; transition: filter .15s, transform .15s; }
.df-btn.df-primary { background: var(--gold); color: #080A07; box-shadow: 0 0 0 0 var(--glow); }
.df-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.df-btnrow { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.1rem 0 .4rem; }
.df-link { background: none; border: 0; color: var(--green); text-decoration: underline; font: inherit; cursor: pointer; padding: .5rem .3rem; min-height: 44px; }
.df-btn:focus-visible, .df-link:focus-visible, .df-choice:focus-visible, summary:focus-visible, .df-check input:focus-visible, .df-tool:focus-visible,
.df-tab:focus-visible, .df-chipbtn:focus-visible, .df-clipdesc summary:focus-visible, .df-lcard:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }

/* the stakes: region name, the species whose status the choices move, and the health meter */
.df-hud { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 2.6fr) minmax(0, 1.1fr); gap: .5rem 1.4rem; align-items: center; margin-top: .9rem;
  padding: .8rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, rgba(20, 28, 18, .85), rgba(12, 17, 11, .85)); }
.df-hud[hidden] { display: none; }
.df-hud-k { font: 700 .66rem/1.2 var(--ui); letter-spacing: .16em; white-space: nowrap; text-transform: uppercase; color: var(--gold); margin: 0 0 .15rem; }
.df-hud-k b { font-size: 1.15em; color: var(--ink); margin-left: .5rem; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.df-hud-name { font: 800 1.2rem/1.1 var(--ui); margin: 0; letter-spacing: -.01em; }
.df-hud-meta { font: 600 .66rem/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: .2rem 0 0; }
.df-stakes { display: flex; flex-wrap: nowrap; gap: .5rem .9rem; --h: .5; min-width: 0; }
.df-stakes:empty { display: none; }
/* The picture fades and greys as the health falls; the NAME and the IUCN WORDS fade only to 70%. Fading the whole card took the status text to 2.4:1 against the panel at health 0 (WCAG AA is 4.5), and the status is the thing a pupil reads (21 Oct QA). */
.df-sp { display: flex; align-items: center; gap: .55rem; flex: 1 1 0; min-width: 0; opacity: calc(.7 + .3 * var(--h)); transition: opacity .9s; }
.df-sp img { width: 2.3rem; height: 2.3rem; border-radius: 50%; object-fit: cover; background: #0b0f0a; border: 1.5px solid var(--line); flex: 0 0 auto; opacity: calc(.4 + .6 * var(--h)); filter: grayscale(calc(1 - var(--h))); transition: opacity .9s, filter .9s; }
html.df-hc .df-sp { opacity: 1; }
/* A flex child will not shrink below its content without this. The text ran 44 px past its chip at every desktop width, under the next
   species' picture: "Northern cardina" and half of "Least Concern" (1280 and 1440 wide, 6 Nov). This was set for phones only. */
.df-sp > div { min-width: 0; }
.df-sp b { display: block; font: 700 .8rem/1.15 var(--ui); overflow-wrap: anywhere; }
.df-iucn { display: inline-block; max-width: 100%; box-sizing: border-box; margin-top: .15rem; font: 800 .62rem/1.1 var(--ui); letter-spacing: .02em; white-space: normal; padding: .22rem .5rem; border-radius: 999px; border: 1.5px solid currentColor; }
.df-iucn.lc { color: var(--green); } .df-iucn.nt { color: #D7D58A; } .df-iucn.vu { color: var(--warn); } .df-iucn.en { color: #F0A070; } .df-iucn.cr, .df-iucn.ew, .df-iucn.ex { color: var(--bad); } .df-iucn.dd, .df-iucn.ne { color: var(--dim); }
.df-stakes-note { grid-column: 1 / -1; order: 5; font: 500 .58rem/1.3 var(--ui); color: var(--dim); margin: 0; }
.df-stakes-note[hidden] { display: none; }
.df-delta { margin-left: .5rem; font: 800 .9rem var(--ui); opacity: 0; transition: opacity .3s, transform .6s; display: inline-block; }
.df-delta.up { color: var(--green); } .df-delta.down { color: var(--bad); } .df-delta.flat { color: var(--dim); }
.df-delta.show { opacity: 1; transform: translateY(-.15rem); }
/* a change of health may never widen the page: if the label and the delta do not fit the column, the delta is cut, not the layout */
.df-health { min-width: 0; }
.df-health .df-hud-k { overflow: hidden; padding-top: .25rem; margin-top: -.25rem; }

/* the meter: ten segments, 10 points each. The fill is green once it has reached the line where the health holds, amber below it, and a
   plain muted red at the bottom; the number and the marked line say the same. */
.df-meter { display: flex; gap: .25rem; margin: .45rem 0 1.15rem; max-width: 30rem; --fill: var(--warn); }
.df-meter.ok { --fill: var(--green); } .df-meter.low { --fill: var(--bad); }
.df-seg { flex: 1 1 0; height: 1rem; border-radius: 3px; background: var(--line); position: relative; transition: background-color .35s, box-shadow .35s; }
.df-seg.on { background: var(--fill); box-shadow: 0 0 .9rem -.1rem var(--fill); }
.df-seg.line { outline: 2px solid var(--gold); outline-offset: 1px; }
.df-seg.line::after { content: "holds"; position: absolute; left: 50%; transform: translateX(-50%); top: 1.25rem; font: 700 .58rem/1 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }

/* start */
.df-hero { display: grid; gap: 1.6rem 3rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 52rem) { .df-hero { grid-template-columns: 1.15fr 1fr; } }
.df-tour { display: flex; flex-wrap: wrap; gap: .4rem .5rem; margin: 0 0 .4rem; padding: 0; }
.df-pill { display: inline-flex; align-items: center; font: 700 .68rem/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: .4rem .7rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); background: rgba(255, 255, 255, .03); }
.df-poster { margin: 0; position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 10; background: #0b0f0a; box-shadow: 0 1.5rem 3rem -1.5rem #000; }
.df-poster-img, .df-poster-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.df-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(4, 7, 3, .86)); pointer-events: none; }
.df-poster-cap { position: absolute; left: 1rem; right: 1rem; bottom: .8rem; z-index: 1; display: flex; flex-direction: column; gap: .15rem; }
.df-poster-cap b { font: 800 1.15rem/1.15 var(--ui); } .df-poster-cap span { font: 600 .62rem/1.3 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: #E7E9DF; }
.df-start-grid { display: grid; gap: 1.6rem 3rem; grid-template-columns: 1fr; align-items: start; margin-top: 1.6rem; }
@media (min-width: 52rem) { .df-start-grid { grid-template-columns: 1.1fr 1fr; } }
.df-how { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; }
.df-steps { margin: 0 0 .6rem; padding-left: 1.3rem; }
.df-steps li { margin: 0 0 .4rem; }
.df-count { border-top: 1px solid var(--line); padding-top: .8rem; max-width: 60rem; }
@media (min-width: 52rem) { .df-count { border-top: 0; padding-top: 0; } }
.df-check { display: inline-flex; align-items: center; gap: .6rem; font: 600 .95rem/1.2 var(--ui); min-height: 44px; cursor: pointer; }
.df-check input { width: 1.4rem; height: 1.4rem; accent-color: var(--gold); }

/* the library */
.df-lib-head { display: flex; flex-wrap: wrap; gap: .6rem 2rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.df-tabs { display: flex; gap: .5rem; }
.df-tab, .df-chipbtn { font: 700 .8rem/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: transparent; border: 1.5px solid var(--line); border-radius: 999px; padding: .6rem 1.1rem; min-height: 3rem; cursor: pointer; }
.df-tab[aria-pressed="true"], .df-chipbtn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: rgba(201, 165, 92, .1); }
.df-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.df-lcard { display: flex; flex-direction: column; gap: .5rem; text-align: left; font: inherit; color: var(--ink); background: linear-gradient(180deg, #151c14, #0e130d); border: 1.5px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem; cursor: pointer; min-height: 11rem; transition: border-color .15s, transform .15s; }
.df-lcard:hover { border-color: var(--gold); transform: translateY(-2px); }
.df-lcard[aria-current="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.df-lcard .df-ic { width: 2.6rem; height: 2.6rem; color: var(--gold); stroke-width: 1.4; }
.df-lcard b { font: 800 1.1rem/1.15 var(--ui); }
.df-lcard .df-tag { font: 700 .62rem/1.2 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--green); }
.df-lcard p { margin: 0; font-size: .82rem; line-height: 1.35; color: var(--dim); }
.df-lcard .df-foot { margin-top: auto; font: 600 .62rem/1.3 var(--ui); letter-spacing: .06em; color: var(--dim); }
.df-lcard .df-thumb { position: relative; margin: -1rem -1.1rem .2rem; border-radius: 14px 14px 0 0; overflow: hidden; aspect-ratio: 16 / 7; background: #0b0f0a; }
.df-lcard .df-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.df-gen { font: 600 .6rem/1.2 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.df-week-badge { display: inline-block; font: 800 .6rem/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: #080A07; background: var(--gold); border-radius: 999px; padding: .25rem .55rem; margin-left: .4rem; vertical-align: middle; }
.df-libpick { border: 1.5px solid var(--gold); border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: 1rem; background: rgba(201, 165, 92, .06); }
.df-libpick .df-btnrow { margin-top: .6rem; }

/* the cinematic opening of a region */
.df-intro-grid { display: grid; gap: 1.2rem 2.6rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 52rem) { .df-intro-grid { grid-template-columns: 1.3fr 1fr; } }
.df-mapwrap { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #0d2330; height: clamp(16rem, calc(100vh - 21rem), 40rem); box-shadow: 0 1.5rem 3rem -1.5rem #000; }
.df-map { position: absolute; inset: 0; }
.df-map-fallback { position: absolute; inset: 0; }
.df-map-fallback img { width: 100%; height: 100%; object-fit: cover; display: block; }
.df-mapcap { position: absolute; left: .8rem; top: .6rem; z-index: 2; margin: 0; max-width: 60%; font: 600 .6rem/1.3 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: #E7E9DF; text-shadow: 0 1px 4px #000; pointer-events: none; }
.maplibregl-ctrl-attrib { font-size: .55rem !important; }
/* the credit's links sit in a sentence of plain text: colour alone (2.0:1 against it) does not mark them (WCAG 1.4.1) */
.maplibregl-ctrl-attrib a { text-decoration: underline !important; }
.df-fig { margin: .4rem 0 0; }
.df-intro-text .df-h1 { font-size: clamp(1.8rem, 2.7vw, 2.8rem); }
/* a fixed height, not only a cap: a cap leaves the picture 0 tall until its file arrives, and the lede beside it then jumps */
.df-fig img { display: block; width: 100%; height: 7.5rem; max-height: 7.5rem; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #0b0f0a; }
.df-fig figcaption { font: 600 .66rem/1.35 var(--ui); letter-spacing: .04em; color: var(--dim); margin-top: .35rem; }

/* progress: numbered pips with a name, the current one marked by weight and an underline as well as colour */
.df-progress { display: flex; gap: .4rem; margin: 0 0 1rem; flex-wrap: nowrap; }
.df-pip { flex: 1 1 0; min-width: 0; border-top: 4px solid var(--line); padding-top: .35rem; font: 600 .68rem/1.25 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.df-pip b { margin-right: .35rem; }
.df-pip i { font-style: normal; }
.df-pip.done { border-top-color: var(--green); color: var(--ink); }
.df-pip.now { border-top-color: var(--gold); color: var(--ink); font-weight: 800; }
@media (max-width: 40rem) { .df-pip i { display: none; } }

/* round and result: situation on the left, the three choices (or the consequence) on the right */
.df-round-grid { display: grid; gap: 1.2rem 2.6rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 52rem) { .df-round-grid { grid-template-columns: 1fr 1.15fr; } }
.df-choices { display: grid; gap: .85rem; }
.df-choice { display: flex; align-items: flex-start; gap: 1.1rem; text-align: left; width: 100%; min-height: 5rem; padding: 1.05rem 1.3rem; border-radius: 18px;
  background: linear-gradient(180deg, #161d15, #0f150e); border: 1.5px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.df-choice:hover { border-color: var(--gold); transform: translateX(3px); box-shadow: 0 0 2rem -.8rem var(--gold); }
.df-key { flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: 50%; border: 2px solid var(--gold); color: var(--gold); display: inline-flex; align-items: center; justify-content: center; font: 800 1.3rem var(--ui); }
.df-ctext strong { display: block; font: 700 1.05rem/1.28 var(--ui); margin-bottom: .2rem; }
.df-ctext span { display: block; color: var(--dim); font-size: 1rem; line-height: 1.35; }
.df-timer { margin-top: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; }
.df-timer-set { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.df-timer-l { font: 700 .66rem/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-right: .2rem; }
.df-chipbtn { padding: .5rem .9rem; min-height: 2.8rem; font-size: .72rem; }
.df-clock { display: flex; align-items: center; gap: .9rem; flex: 1 1 14rem; }
.df-clock-n { font: 800 2.6rem/1 var(--ui); font-variant-numeric: tabular-nums; min-width: 4.2ch; }
.df-clock-bar { flex: 1; height: .5rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.df-clock-bar i { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: left; }
.df-clock.low .df-clock-n { color: var(--bad); } .df-clock.low .df-clock-bar i { background: var(--bad); }

.df-record { margin-top: .6rem; }
.df-chips { display: grid; gap: .4rem; }
.df-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .1rem .8rem; }
.df-chip summary { cursor: pointer; font: 600 .75rem/1.3 var(--ui); letter-spacing: .06em; color: var(--green); padding: .6rem 0; min-height: 44px; display: flex; align-items: center; }
.df-chip p { font-size: .88rem; line-height: 1.4; color: var(--dim); margin: 0 0 .7rem; }

.df-chosen { font: 700 1.15rem/1.3 var(--ui); margin: 0 0 .8rem; display: flex; align-items: flex-start; gap: .8rem; }
.df-chosen .df-key { width: 2.4rem; height: 2.4rem; font-size: 1.05rem; }
.df-wait { display: flex; align-items: center; gap: .35rem; font: 700 .9rem/1.2 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: .6rem 0 1rem; }
.df-wait[hidden] { display: none; }
.df-wait i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--gold); animation: dfdot 1s infinite ease-in-out; }
.df-wait i:nth-of-type(2) { animation-delay: .15s; } .df-wait i:nth-of-type(3) { animation-delay: .3s; }
@keyframes dfdot { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }
.df-card { background: linear-gradient(180deg, #141b13, #0e130d); border: 1px solid var(--line); border-radius: 18px; padding: 1.1rem 1.3rem; transition: opacity .55s, transform .55s; }
#result.is-wait .df-card { opacity: 0; transform: translateY(.7rem); visibility: hidden; }
#result.is-wait #next, #result.is-wait #back { visibility: hidden; }
.df-badge { display: inline-block; font: 800 .85rem/1.2 var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: .45rem .8rem; border-radius: 999px; border: 1.5px solid currentColor; margin: 0 0 .7rem; }
.df-badge.sm { font-size: .64rem; padding: .25rem .55rem; margin: 0 .3rem 0 0; }
.df-o-strong { color: var(--gold); }
.df-o-partial { color: var(--warn); }
.df-o-weak { color: var(--dim); }
.df-found { font: 700 .9rem/1.35 var(--ui); color: var(--green); margin: 0 0 .6rem; }
.df-found span { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-right: .2rem; }
.df-result { font-size: 1.12rem; line-height: 1.5; margin: 0 0 .7rem; }
.df-basis { font: 600 .82rem/1.4 var(--ui); color: var(--dim); margin: 0 0 .8rem; }
.df-behind-h { font: 700 .68rem/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: .6rem 0 .4rem; }
.df-fact { border-top: 1px solid var(--line); }
.df-fact summary { cursor: pointer; padding: .55rem 0; min-height: 44px; }
.df-fact p.df-said { margin: 0 0 .7rem; font-size: .9rem; line-height: 1.45; color: var(--dim); }
.df-src { display: block; font: 600 .75rem/1.3 var(--ui); color: var(--ink); }
.df-url { font: 500 .72rem/1.35 var(--ui); word-break: break-all; color: var(--dim); display: block; }

/* the ending */
.df-end-grid { display: grid; gap: 1.2rem 2.6rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 52rem) { .df-end-grid.has-clip { grid-template-columns: 1fr 1.3fr; } }
.df-end-grid.won .df-h1 { background: linear-gradient(90deg, var(--gold), #F2DFA8, var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.df-stage { margin: 0; }
.df-stage[hidden] { display: none; }
/* LETTERBOXED, NEVER CROPPED. Josh: only the opener is full-bleed; every other clip shows its whole frame. The
   frame is 16:9 whatever the clip, the clip sits inside it with contain, and the bars are black. */
.df-frame { width: min(100%, calc(62vh * 16 / 9)); aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; margin: 0 auto; }
.df-frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.df-credit { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .9rem; width: min(100%, calc(62vh * 16 / 9)); margin: .5rem auto 0; font: 600 .8rem/1.3 var(--ui); }
.df-foot { margin-top: 1.6rem; padding-top: .6rem; border-top: 1px solid var(--line); font: 500 .8rem/1.4 var(--ui); color: var(--dim); }
.df-foot .df-link { font: inherit; }
.df-clipdesc { flex: 1 1 100%; }
.df-clipdesc summary { cursor: pointer; color: var(--green); min-height: 44px; display: flex; align-items: center; }
.df-clipdesc p { margin: 0 0 .6rem; font-weight: 500; line-height: 1.45; color: var(--dim); max-width: 46rem; }
.df-verified { color: var(--ink); letter-spacing: .04em; }
.df-credit-sub { color: var(--dim); font-weight: 500; flex: 1 1 auto; }
.df-stills { grid-column: 1 / -1; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.df-stills[hidden] { display: none; }
.df-still { margin: 0; }
.df-still img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #0b0f0a; }
.df-still figcaption { font: 600 .66rem/1.35 var(--ui); letter-spacing: .03em; color: var(--dim); margin-top: .35rem; }
.df-still figcaption b { color: var(--ink); display: block; font-size: .78rem; }
.df-missed { grid-column: 1 / -1; }
.df-recap { margin-top: 1.6rem; display: grid; gap: .5rem 2rem; grid-template-columns: 1fr; }
@media (min-width: 70rem) { .df-recap { grid-template-columns: 1fr 1fr; } .df-recap .df-h3 { grid-column: 1 / -1; } }
.df-row { border-top: 1px solid var(--line); padding: .5rem 0; }
.df-row p { margin: 0 0 .15rem; font-size: .92rem; line-height: 1.4; }
.df-row-h { font: 700 .72rem/1.3 var(--ui) !important; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.df-best { color: var(--gold); font-size: .85rem !important; }
.df-srcs { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.df-srclist { padding-left: 1.3rem; }
.df-srclist li { margin-bottom: .7rem; font-size: .88rem; line-height: 1.4; color: var(--dim); }
.df-srclist strong { color: var(--ink); }
.df-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 20; }

/* THE RESULTS (both endings). One card: a neon picture drawn by code, the region, the threat, the date, the health, and the choices.
   Every length inside it is in em, so the same card can be set larger for the projector's class photo (the .is-photo rule sizes it
   from the screen) without a second set of rules. While it plays, each part is held back (.is-seq) and brought in by the clock;
   reduced motion never adds .is-seq, so every part is there from the first frame. Colour never carries the meaning: the seal and
   the health are words and numbers, the segments are a second reading of the number. */
.df-btn[hidden], .df-btnrow[hidden], .df-im-sp[hidden], .df-results[hidden] { display: none; }
.df-results { margin: 0 0 1.6rem; outline: none; }
.df-impact { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-areas: "art head" "list list"; gap: 1.1em 2em; padding: 1.2em 1.4em 1.3em;
  font-size: 1rem; border: 1.5px solid var(--gold); border-radius: 22px; background: #020402;
  box-shadow: 0 0 3rem -1.4rem var(--gold), inset 0 0 5rem -4rem var(--green); }
.df-impact.is-loss { border-color: var(--green); box-shadow: 0 0 3rem -1.4rem var(--green), inset 0 0 5rem -4rem var(--gold); }
.df-im-art { grid-area: art; margin: 0; align-self: start; min-width: 0; }
.df-im-cv { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; border: 1px solid var(--line); }
.df-im-artcap { font: 600 .62em/1.35 var(--ui); color: var(--dim); margin-top: .5em; }
.df-im-head { grid-area: head; min-width: 0; }
.df-im-kicker { font: 700 .72em/1.3 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 0 0 .5em; }
.df-im-seal { display: inline-block; font: 800 .8em/1.2 var(--ui); letter-spacing: .09em; text-transform: uppercase; color: var(--gold); border: 2px solid currentColor; border-radius: 1.3em; max-width: 100%;
  padding: .4em .95em; margin: 0 0 .7em; transform: rotate(-2deg); box-shadow: 0 0 1.2em -.3em var(--gold); }
.df-im-seal:empty { display: none; }
.df-impact.is-loss .df-im-seal { color: var(--green); box-shadow: 0 0 1.2em -.3em var(--green); }
.df-im-name { font: 800 2em/1.05 var(--ui); letter-spacing: -.02em; margin: 0 0 .25em; text-wrap: balance; overflow-wrap: anywhere; }
.df-im-threat { font: 700 1em/1.3 var(--ui); color: var(--green); margin: 0 0 .15em; }
.df-im-date { font: 600 1em/1.3 var(--ui); color: var(--dim); margin: 0 0 .7em; }
.df-im-hl { font: 700 .72em/1.25 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin: 0 0 .2em; }
.df-im-hl b { font-size: 2.6em; line-height: 1; letter-spacing: 0; color: var(--ink); margin-left: .35em; font-variant-numeric: tabular-nums; }
.df-im-hof { text-transform: none; letter-spacing: 0; color: var(--dim); font-size: 1.3em; }
.df-im-meter { display: flex; gap: .25em; --fill: var(--green); max-width: 26em; margin: .35em 0 .45em; }
.df-im-seg { flex: 1 1 0; height: .8em; border-radius: 3px; background: var(--line); transition: background-color .3s, box-shadow .3s; }
.df-im-seg.on { background: var(--fill); box-shadow: 0 0 .8em -.1em var(--fill); }
.df-im-seg.line { outline: 2px solid var(--gold); outline-offset: 1px; }
.df-im-hnote { font: 600 1em/1.35 var(--ui); color: var(--dim); margin: 0; }
.df-im-list { grid-area: list; min-width: 0; border-top: 1px solid var(--line); padding-top: .8em; }
.df-im-lh { font: 700 .75em/1.3 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin: 0 0 .6em; }
.df-im-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .8em 2em; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 70rem) { .df-im-rows { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.df-im-row { display: flex; gap: .7em; align-items: flex-start; min-width: 0; }
.df-im-mark { color: var(--gold); font-size: 1.1em; line-height: 1.3; flex: 0 0 auto; }
.df-im-row > div { min-width: 0; }
.df-im-rk { font: 700 .62em/1.3 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 0 0 .2em; }
.df-im-rl { font: 700 1em/1.28 var(--ui); margin: 0 0 .15em; overflow-wrap: anywhere; }
.df-im-ro { font: 500 1em/1.3 var(--ui); color: var(--green); margin: 0; }
.df-im-sp { font: 600 1em/1.4 var(--ui); color: var(--dim); margin: .8em 0 0; }
.df-im-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; margin: 0 0 .9rem; }
.df-im-tools .df-btnrow { margin: 0; }
.df-im-note { margin: 0; flex: 1 1 18rem; }
.df-big { gap: 1rem; margin: 1.3rem 0 .6rem; }
.df-bigbtn { flex: 1 1 16rem; min-height: 5rem; font-size: 1.1rem; }
.df-im-close { position: absolute; top: .7em; right: .9em; z-index: 2; min-height: 44px; padding: .45em 1.1em; font: 700 .6em/1 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); background: #000; border: 1.5px solid var(--gold); border-radius: 999px; cursor: pointer; }
.df-im-close[hidden] { display: none; }
.df-im-close:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
.df-btn#photoBtn { border-color: var(--green); }

/* held back while it plays, brought in by the clock */
.df-impact [data-im] { transition: opacity .55s, transform .55s; }
.df-impact.is-seq [data-im]:not(.is-in) { opacity: 0; transform: translateY(.5em); }
.df-impact .df-im-seal { transition: opacity .3s, transform .55s cubic-bezier(.2, 1.5, .4, 1); }
.df-impact.is-seq .df-im-seal:not(.is-in) { opacity: 0; transform: scale(1.9) rotate(-9deg); }

/* THE CLASS PHOTO. A fixed layer over the page, black, the card at the size the screen allows (school-defend.js sets the font size and
   shrinks it until the whole card fits; where it cannot, the card scrolls). */
body.df-photo-on { overflow: hidden; }
.df-impact.is-photo { position: fixed; inset: 0; z-index: 40; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: #000; overflow: auto; align-content: center; padding: 3vh 3.2vw; gap: 1em 2.4em; }
.df-impact.is-photo .df-im-cv { border-color: transparent; }

@media (min-width: 52rem) {
  /* on the full screen the picture and the facts sit on the left and the choices on the right, so the type can be large */
  .df-impact.is-photo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "art list" "head list"; align-content: center; align-items: start; }
  .df-impact.is-photo .df-im-list { border-top: 0; padding-top: 0; }
  .df-impact.is-photo .df-im-rows { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 52rem) {
  .df-impact { grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "head" "list"; padding: .9em 1em 1em; }
  .df-im-name { font-size: 1.6em; }
  .df-impact.is-photo { align-content: start; padding: 3.5rem 1rem 1.2rem; }
}
html.df-hc .df-impact { background: #000; border-width: 2.5px; }
html.df-hc .df-im-ro, html.df-hc .df-im-threat { color: var(--green); }
@media (prefers-reduced-motion: reduce) { .df-impact [data-im], .df-impact .df-im-seal, .df-im-seg { transition: none; } .df-btn { transition: none; } }
/* The loss seal is stamped in from scale(1.9) and rotated, and a transform that has not finished still counts as overflow even at opacity 0: on a loss
   the long seal widened the PAGE (to 510px at 393, 1538 at 1440, 2109 at 1920) for the whole 7 s sequence, then settled, so a check made at the end
   saw nothing. Clip the card's sideways overflow; the stamp lands inside the card, the glow around the card is its own shadow and is not clipped. */
.df-impact { overflow-x: clip; }
/* THE PROJECTOR (1700px and wider, 1920 measured): every word in the results block is 28px or more. The small-caps labels (round, list heading,
   seal, caption, the Close button), the hints and the two buttons were 17 to 24px beside 28px choices, and a back row cannot read 17px. The full-screen
   card spends the room this needs on its padding and gaps and gives the picture a slightly narrower column, so the Klamath card still fits at 28px.
   On the full-screen card FITTING wins over the 28px floor: a threat with more regions or longer choices shrinks the type (measured 23 to 28px at
   1920x1080 across the 17 threats, and 25 for urban sprawl and for dams before this block), because a class photo must hold the whole card. */
@media (min-width: 1700px) {
  .df-results .df-btn, .df-results .df-hint { font-size: 1rem; }
  .df-im-kicker, .df-im-seal, .df-im-hl, .df-im-lh, .df-im-rk, .df-im-artcap, .df-im-close, .df-im-hof { font-size: 1em; }
  .df-im-hl b { font-size: 1.85em; }
  .df-impact.is-photo { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); padding: 1.6vh 2.4vw; gap: .6em 2em; }
  .df-impact.is-photo .df-im-rows { gap: .55em 2em; }
  .df-impact.is-photo .df-im-kicker { margin-bottom: .25em; }
  .df-impact.is-photo .df-im-date { margin-bottom: .4em; }
  .df-impact.is-photo .df-im-lh { margin-bottom: .35em; letter-spacing: .1em; }   /* at 28px the longest heading ran under the Close button (top right); .1em clears it by 50px */
  .df-impact.is-photo .df-im-sp { margin-top: .5em; }
}

/* a short viewport (a laptop at 1366x768, a phone turned sideways) keeps the choices on screen without scrolling the page */
/* 80rem (1280px), not 52rem: the root size follows the viewport, so below ~1280 the four tools and the title no longer fit one line and pushed the page 11 to 60px sideways at 1160-1240 (an iPad on a projector, 21 Oct QA). They wrap there. */
/* The label under the name, not between name and tools: the root size follows the viewport, so that gap never fits it at any width (5 Nov: 69px for 374px at 1440, 351 for 421 at 1920). The header is 5 to 16 px taller for it, and the choices still fit a laptop's screen. */
@media (min-width: 80rem) {
  .df-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1.2rem; row-gap: 0; align-items: center; }
  .df-brand { grid-column: 1; grid-row: 1; justify-self: start; }
  .df-where { grid-column: 1; grid-row: 2; white-space: normal; overflow: visible; text-overflow: clip; }
  .df-tools { grid-column: 2; grid-row: 1 / span 2; flex-wrap: nowrap; flex: 0 0 auto; }
}
/* a laptop (1440 x 900): the situation, the three choices and the HUD share one screen */
@media (min-width: 52rem) and (max-height: 1000px) {
  .df-hud { padding: .55rem 1rem; margin-top: .6rem; }
  .df-hud-meta { display: none; }
  .df-choice { padding: .7rem 1.1rem; min-height: 4rem; }
  .df-choices { gap: .6rem; }
  .df-key { width: 2.5rem; height: 2.5rem; font-size: 1.1rem; }
  .df-progress { margin-bottom: .6rem; }
  .df-timer { margin-top: .6rem; }
}
@media (min-width: 52rem) and (max-height: 760px) {
  html.df-on { font-size: clamp(.9375rem, calc(0.6vw + .6875rem), 1.375rem); }
  .df-lede { font-size: 1.05rem; margin-bottom: .6rem; }
  .df-choice { padding: .7rem 1rem; }
}
/* a phone: the hud stacks, the species lose their pictures so three of them fit a line */
@media (max-width: 52rem) {
  .df-hud { grid-template-columns: 1fr; padding: .7rem .9rem; }
  .df-stakes { flex-wrap: wrap; }
  .df-sp { flex: 1 1 9rem; }
  .df-mapwrap { height: 18rem; }
  .df-sp img { width: 2rem; height: 2rem; }
  .df-clock-n { font-size: 2rem; }
  /* the words go off screen, not out of the page: display:none left three buttons with no name for a screen reader (axe button-name, WCAG 4.1.2, 393 wide) */
  .df-tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .df-tool { padding: .5rem .7rem; position: relative; }
  .df-tool#leave span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  /* 320 CSS px (WCAG 1.4.10): the title is a no-wrap line 348px wide; it wraps instead of widening the page */
  .df-brand { white-space: normal; flex-wrap: wrap; }
}

/* HIGH CONTRAST: a teacher's switch, and what prefers-contrast: more asks for. Thicker lines, pure black and white. */
html.df-hc { --ink: #fff; --dim: #E6EADF; --bg: #000; --panel: #000; --line: #9AA58F; --gold: #FFD76A; --green: #9CFFC4; --warn: #FFC94D; --bad: #FFB3A3; --card: #000; }
html.df-hc body, html.df-hc .df-root { background: #000; }
html.df-hc .df-choice, html.df-hc .df-card, html.df-hc .df-lcard, html.df-hc .df-hud, html.df-hc .df-how, html.df-hc .df-chip { background: #000; border-width: 2.5px; }
html.df-hc .df-seg { background: #4a5244; } html.df-hc .df-seg.on { box-shadow: none; }
html.df-hc .df-end-grid.won .df-h1 { background: none; color: var(--gold); }
@media (prefers-contrast: more) {
  :root { --ink: #fff; --dim: #E6EADF; --line: #9AA58F; --gold: #FFD76A; --green: #9CFFC4; --panel: #000; }
  .df-choice, .df-card, .df-lcard, .df-hud, .df-how { background: #000; border-width: 2.5px; }
}
@media (forced-colors: active) { .df-seg.on { background: Highlight; } .df-seg { border: 1px solid CanvasText; } .df-choice, .df-card, .df-lcard { border-color: CanvasText; } }

@media (prefers-reduced-motion: reduce) {
  .df-btn, .df-choice, .df-lcard, .df-card, .df-sp, .df-sp img, .df-seg, .df-delta { transition: none; }
  .df-wait i { animation: none; opacity: 1; }
}
/* THE START SCREEN IS FILLED BY SCRIPT once the threat's file arrives: until then it held "..." in the title, rule and note, and
   the poster, the text column and the two boxes below it jumped to their real sizes (layout shift 0.19 at 1440, three runs, 9 Mbps
   and 4x CPU, 18 Nov). The poster already has its aspect-ratio; the text does not, and cannot. So the screen keeps its place and is
   not shown until startScreen() has written #startBlurb: a hidden box is not a shift. Only where script runs (without it the
   page redirects anyway), and the animation lifts the rule after 4 s if the file never comes. */
@media (scripting: enabled) {
  #start:has(#startBlurb:empty) { visibility: hidden; animation: df-unhide 0s linear 4s forwards; }
}
@keyframes df-unhide { to { visibility: visible; } }
@media print { .df-root, .df-fx { display: none; } }
