/* las-lasvy.css — the reader as a book page, situations as a conversation, the player docked above the tab bar
   (design "Läs - läsvy och I dag", rounds 4–7, Linh 2026-10-23). Load LAST, after lasning.css and idag.css.
   Ink vs fill as everywhere: --blue/--ok/--bad are fills, the -ink tokens are text, strokes and borders.
   The book tokens below are new and are declared with their dark values; nothing else invents a colour. */

:root {
  --bok: #fbf6ea;          /* the page */
  --bok-kant: #e9dfc9;     /* hairlines and the others' bubble edge */
  --bok-ink: #2a2620;      /* text on the page: 14:1 on --bok */
  --bok-mjuk: #6b6152;     /* soft ink: narration in a situation, kickers, numbers: 5.5:1 on --bok */
  --bok-dock: #fffcf5;     /* the player, the word sheet, cards on the page */
  --bok-knapp: #f0e7d3;    /* round buttons on the page and in the player */
  --bok-knappkant: #e0d4bb;
  --bok-linje: #cdbf9f;    /* the ornament's rules */
  --bok-moln: #fffcf5;     /* the others' bubble */
  --bok-markor: rgba(196, 87, 26, .2);  /* the highlighter: the terracotta "you are here", as a stroke */
  --bok-sky: rgba(42, 38, 32, .42);     /* blurred text in Dold */
  --dockh: 118px;          /* the player's height; the page keeps this much room at the bottom (js/reader.js maetLage measures the real one) */
  --barh: 61px;            /* the sticky top bar's height (measured the same way) */
  --dolds: 170px;          /* the Dold card's height (measured the same way) */
  --sitrum: 28px;          /* the space between a scene's task and its first line */
  --forra-op: .7;          /* how faded the sentence before is in Mening of a situation, when another speaker said it: the bubble's own fade (ink on it still 5:1 or more) */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bok: #1d1a16; --bok-kant: #332d25; --bok-ink: #e9e1d2; --bok-mjuk: #a89d8a; --bok-dock: #25211b;
    --bok-knapp: #332d25; --bok-knappkant: #3a342b; --bok-linje: #4a4236; --bok-moln: #26221c;
    --bok-markor: rgba(240, 160, 112, .26); --bok-sky: rgba(233, 225, 210, .36);
  }
}

/* ---- the page ---- */
body:has(#readView:not([hidden])) { background: var(--bok); }
/* --topp: where the pinned top ends, measured from the top of the screen: the notch's strip, the sticky bar and, under it, the pinned episode row (EP-RAD, 2026-10-26; --radh is the row's measured height, 0 when the row is not shown or does not stick). Everything the page is scrolled to, floats at or is measured from "below the bar" starts here.
   --scen: the band between the pinned top and the player, the room a reading stage has (Dold's card is centred in it; Mening's sentence starts at --anker, 38 % of it). 100svh is the screen with the browser's bars out, so the band does not change while the page is scrolled; never less than 240px (a phone on its side reads by scrolling). */
#readView { --radh: var(--radm, 0px); --topp: calc(env(safe-area-inset-top, 0px) + var(--barh) + var(--radh)); --scen: max(240px, calc(100svh - var(--topp) - var(--navh, calc(64px + env(safe-area-inset-bottom, 0px))) - var(--dockh))); color: var(--bok-ink); padding-bottom: calc(var(--dockh) + 28px); }
#readView .rhead { background: var(--bok); border-bottom-color: transparent; box-shadow: 0 calc(-1 * env(safe-area-inset-top, 0px)) 0 var(--bok); padding: 4px 14px 4px 4px; }
#readView.rullad .rhead { border-bottom-color: var(--bok-kant); }
body:has(#readView:not([hidden])) .sparadtoast { bottom: calc(var(--navh, calc(64px + env(safe-area-inset-bottom, 0px))) + var(--dockh) + 14px); }

/* the top bar: back, the episode's name once the chapter has scrolled away, saved words, settings */
#readView .rtitlerow { display: flex; align-items: center; gap: 8px; min-height: 52px; max-height: none; overflow: visible; }
#readView .rtitlerow .who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* still read out; the visible title is the chapter */
#readView .riconbtn.tillbaka { height: 44px; padding: 0 8px 0 4px; background: none; color: var(--blue-ink); font-size: 16px; font-weight: 600; }
.rtopp { flex: 1; min-width: 0; text-align: center; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; }
#readView.rullad .rtopp { opacity: 1; }
#readView #epSparade { flex: none; position: relative; }
#readView #epSparade::after { content: ""; position: absolute; inset: -8px -4px; } /* a 44 px target around the 28 px pill (added by @dev) */
/* PIN-2 (docs/decisions/2026-10-24-pin-2.md 4 and 14 C, Linh 2026-10-24: the pin in the top bar, not in the settings): between the saved words and the settings, 44 x 44, always on screen (the bar sticks). Two shapes, never colour alone: the outline pin on the bar's own ground
   when not pinned, the filled pin on the accent when pinned (--blue with --on-blue, the tokens of the old toggle; 3:1 or more in the light and the dark theme). `.vantar` keeps its place before the list has been read, so nothing moves when it appears; it is out of the tab order then.
   No transition anywhere: the state changes at once, also under reduced motion and Mer's Rörliga bilder off. */
#readView #fastBtn { flex: none; box-sizing: border-box; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--blue-ink, var(--blue)); cursor: pointer; }
#readView #fastBtn[hidden] { display: none; }
#readView #fastBtn.vantar { visibility: hidden; }
#readView #fastBtn.pa { background: var(--blue); color: var(--on-blue); }
#readView #fastBtn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
#readView #fastBtn svg { display: block; }
/* LAS-FAVORIT: the heart beside the pin, the same 44 px button; a favourite is the heart filled */
#readView #favBtn { flex: none; box-sizing: border-box; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--blue-ink, var(--blue)); cursor: pointer; }
#readView #favBtn[hidden] { display: none; }
#readView #favBtn.pa svg path { fill: currentColor; }
#readView #favBtn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
/* what a tap on the pinned pin says: a status line directly under the sticky bar (the bar is the positioned parent) and under the pinned episode row (EP-RAD: --radh, so it does not cover the stops), so it is in view wherever the text is scrolled to; gone after six seconds (js/app.js) */
#readView .rfastnot { position: absolute; z-index: 1; inset-inline: 14px; top: calc(100% + var(--radh, 0px) + 6px); margin: 0; padding: 10px 14px; border: 1px solid var(--bok-kant); border-radius: 12px; background: var(--bok-dock); color: var(--bok-ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); font-size: 15px; line-height: 1.4; text-wrap: pretty; }
/* the back label gives way before the pin and the settings do (C9): the title that shows once the opening has scrolled away goes first (.rtopp, flex: 1), then the label, by an ellipsis; the accessible name has it whole */
#readView .riconbtn.tillbaka { flex: 0 1 auto; min-width: 0; }
#readView .riconbtn.tillbaka > span { flex: 0 1 auto; min-width: 0; max-width: 38vw; }
.rinst { flex: none; height: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px 0 11px; border: 0; border-radius: 12px; background: var(--bok-knapp); color: var(--bok-ink); }
.rinst span { font-size: 14px; font-weight: 600; color: var(--granite); }
.rinst svg { display: block; }
/* OVA-PA (Linh 2026-11-06, "Settings as an icon"): under 400 px a series episode's bar holds back, saved words, Öva, heart, pin and settings only with the settings button as its gear alone (the word stays
   its accessible name, set by js/reader.js paintInst) and 4 px between the buttons; at 320 px the back arrow had been squeezed to nothing before. Above 400 px the word shows as before (LAS-INST). */
@media (max-width: 400px) { #readView .rtitlerow { gap: 4px; } #readView .riconbtn.tillbaka { flex: none; min-inline-size: 44px; } .rinst { inline-size: 44px; padding: 0; justify-content: center; } .rinst span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } }

/* the episode stops on the page, pinned under the bar (EP-RAD, Linh 2026-10-26: "in story read pages, can we pin the episodes list when scrolling down"). The row is one line of 30 px stops with 6 px above and below and a hairline edge (43 px): it sticks right under the sticky bar (at the bar's measured height, --barh), on the page's own ground and with the bar's own width,
   so the text scrolls under it cleanly; it keeps scrolling sideways inside itself for a long season. The hairline comes with the bar's own (the opening has scrolled away: #readView.rullad); the bar's edge steps aside then, so the pair has one edge, at the bottom of the row. A row with nothing to choose (a scene, a pasted text, a story of one episode and no introduction: js/app.js drawLine sets .ensam) is not drawn, so no empty strip is pinned.
   No transition and no animation: it sticks and nothing slides, with or without reduced motion. On a screen too short to spare it (a phone on its side) it is an ordinary row again and scrolls away with the text, and --radh is 0. */
#readView .line { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--barh)); z-index: 4; margin: 0 -1em; padding: 6px 1em; background: var(--bok); border-bottom: 1px solid transparent; justify-content: safe center; }
#readView .line.ensam { display: none; }
#readView.rullad .line { border-bottom-color: var(--bok-kant); }
@media (min-height: 501px) { #readView.rullad:has(> .line:not(.ensam)) .rhead { border-bottom-color: transparent; } } /* (a row that does not stick leaves the bar its own edge) */
#readView .line .stop::after { content: ""; position: absolute; inset: -6px -3px; } /* a 42 px target around the 30 px stop, up to the row's own edge; the gap between two stops is 6 px, so two targets meet and never overlap */
@media (max-height: 500px) { #readView { --radh: 0px; } #readView .line { position: static; } }
/* what the browser scrolls to when a control or the opening gets the focus (Tab, a script's focus()) stops below the pinned top, with a little air (WCAG 2.2, 2.4.11 Focus Not Obscured). Only the page's own blocks: the bar, the player and the sheets are fixed or sticky and never scroll. The text's words are not focusable. */
#readView :is(#ljudNotis, #egenTips, #epIntro, #epStatus, #epKapitel, #epOrd, #epSlut, #epOva) :is(button, a[href], input, select, textarea, summary, [tabindex]) { scroll-margin-top: calc(var(--topp) + 8px); }
#readView .line .stop.klar .tick { border-color: var(--bok); }
#readView .line .stop.last { border-color: var(--bok-knappkant); color: var(--bok-mjuk); }

/* ---- the chapter opening (a story) and the scene opening (a situation) ---- */
/* (the opening is a <header>, which app.css gives side padding and `justify-content: space-between`: the padding is taken away and the column fills the width, so the opening has the story's own edges and the task card is as wide as the conversation under it) */
/* KAPITEL-MITT (Linh, 2026-11-02): auto inline margins, as app.css gives every <header> (max-width 720px): with WEB-BRED's 1100 px column on a laptop a 0 margin put the opening at the column's left */
.kapitel { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; justify-items: center; gap: 6px; margin: 22px auto; padding-inline: 0; text-align: center; }
.kapitel[hidden] { display: none; }
.kapitel .kkick { font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--bok-mjuk); }
.kapitel h1 { margin: 0; font: 400 36px/1.1 var(--serif); color: var(--bok-ink); overflow-wrap: anywhere; outline: none; }
.kapitel .ornament { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.kapitel .ornament::before, .kapitel .ornament::after { content: ""; width: 36px; height: 1px; background: var(--bok-linje); }
.kapitel .ornament i { width: 6px; height: 6px; transform: rotate(45deg); background: var(--blue); }
/* a scene: the task is a block of its own, 28px (--sitrum) above the first line of the scene (Linh's iPhone, 2026-10-23: "increase the distant between instruction text and conversation") */
.kapitel.sit { gap: 4px; margin: 16px auto var(--sitrum); padding-bottom: 0; }
.kapitel.sit h1 { font-size: 32px; }
.kapitel .uppgift { justify-self: stretch; display: grid; gap: 2px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--bok-dock); border: 1px solid var(--bok-kant); text-align: start; }
.uppgift .ulbl { font-size: 14px; font-weight: 600; color: var(--granite); }
.uppgift .usv { font-size: 16px; line-height: 1.4; color: var(--bok-ink); }
.uppgift .uen { font-size: 14px; line-height: 1.4; font-style: italic; color: var(--granite); }

/* ---- the text, every mode ---- */
/* The column: main's own gutter (17px) is the whole side margin, so the text has the width of the screen less 34px at a phone's width; a wider screen keeps a reading measure (34em of 21px, about 70 characters), centred (Linh's iPhone, 2026-10-23: "a bit too wide margin ... the actual space for text a bit narrow"). */
#readView .story { max-width: 34em; margin: 0 auto; padding: 0 0 6px; font-family: var(--serif); font-size: 21px; line-height: 1.58; color: var(--bok-ink); text-wrap: pretty; }
#readView .story p { max-width: none; margin: 0; }
#readView .story .sent.now { background: linear-gradient(transparent 10%, var(--bok-markor) 10%, var(--bok-markor) 92%, transparent 92%); box-shadow: none; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#readView .story .w.saved { text-decoration: underline dotted var(--blue-ink) 1.5px; text-underline-offset: 4px; }
#readView .story .w.vald { border-radius: 4px; box-shadow: 0 0 0 2px var(--blue-ink); }
.story .said .who::before { content: none; }

/* ---- a story: the book page (Hela texten) ---- */
.story:not(.samtal) > p + p:not(.said) { text-indent: 1.3em; }
.story.mode-2:not(.samtal) > p:first-child::first-letter { float: left; font-size: 66px; line-height: .8; padding: 7px 8px 0 0; color: var(--blue-ink); }
/* dialogue as a script: the speaker in a column of its own, every reply starting at one edge (js/reader.js wraps a run of replies in .repliker) */
.story:not(.samtal) .repliker { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: baseline; margin: .35em 0; text-align: start; text-wrap: wrap; }
.story:not(.samtal) .repliker > .said { display: contents; }
.story:not(.samtal) .said .who { display: block; max-width: 7em; padding: 0; border-radius: 0; background: none; font: 700 14px/1.3 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--ri, var(--granite)); overflow-wrap: anywhere; }
.story:not(.samtal) .said .ton { display: block; }
.story .said .ton { font: italic 400 14px/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--bok-mjuk); }

/* ---- a situation: the conversation ---- */
#readView .story.samtal { padding: 0 0 6px; font-size: 20px; line-height: 1.45; }
.story.samtal > p:not(.said) { margin: 18px 0 6px; max-width: none; text-align: start; font-size: 18px; line-height: 1.55; color: var(--bok-mjuk); text-wrap: pretty; }
.story.samtal > p:not(.said) .sent.now { color: var(--bok-ink); }
/* ALL the narration of a situation is read as a paragraph from the start edge, the edge the others' bubbles begin at (and mirrored in right-to-left), not in the middle: the setup before the first line anyone says, the narration between two lines, a narrated sentence in Mening's stage
   (Linh's iPhone, 2026-10-23: "situation instruction words seems to be centered align, which looks weird", then "the narrator text is centered which looks weird ... I think you made the first narrator text ok but the rest has same issue"). The setup has --sitrum between it and the first bubble; narration between two lines has room above and below it. */
#readView .story.samtal:not(.mode-1) > p:not(.said):not(.said ~ p) { margin: 0 0 .8em; }
#readView .story.samtal:not(.mode-1) > p:not(.said):not(.said ~ p):has(+ .said) { margin-bottom: var(--sitrum); }
#readView .story.samtal:not(.mode-1) > .said ~ p:not(.said) { margin: 14px 0 8px; }
.story.samtal .said { display: grid; justify-items: start; gap: 4px; margin: 12px 0 0; }
.story.samtal .said .who { display: flex; align-items: baseline; gap: 8px; padding: 0 0 0 6px; border-radius: 0; background: none; font: 700 14px/1.3 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--ri, var(--granite)); }
.story.samtal .said .what { max-width: 84%; padding: 10px 14px 11px; border-radius: 18px 18px 18px 6px; background: var(--bok-moln); border: 1px solid var(--bok-kant); }
.story.samtal .said.fortsatt { margin-top: 6px; }
.story.samtal .said.fortsatt .who { display: none; }
.story.samtal .said[data-jag] { justify-items: end; }
.story.samtal .said[data-jag] .who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.story.samtal .said[data-jag] .what { border-radius: 18px 18px 6px 18px; border-color: transparent; background: var(--blue-soft); color: var(--ink); }

/* ---- Dold: the shape of the text, blurred, the highlighter still moving; the card offers the two ways to read along ----
   The card floats in the middle of the band while the learner is over the text (position: sticky inside #epTextyta, the text's own area) and goes up with the end of the text, so it never lies over what comes after it ("Fraser i avsnittet", the end card).
   Its top is where a card of its own height (--dolds, measured) is centred in the band (--scen). Before the learner has scrolled to it the card stands where it always stood, under the opening. */
#readView .story.mode-0 { display: block; }
.story.mode-0 .sent, .story.mode-0 .who, .story.mode-0 .ton { color: transparent; text-shadow: 0 0 9px var(--bok-sky); user-select: none; -webkit-user-select: none; }
.story.mode-0 .w.saved { text-decoration-color: transparent; }
.epdold { position: sticky; z-index: 2; top: calc(var(--topp) + (var(--scen) - var(--dolds)) / 2); display: grid; gap: 12px; margin: 0 0 16px; padding: 14px 16px; border-radius: 16px; background: var(--bok-dock); border: 1px solid var(--bok-kant); box-shadow: 0 6px 22px rgba(70, 50, 20, .10); }
.epdold[hidden] { display: none; }
.epdold div > b { font-size: 17px; font-weight: 650; }
.epdold p { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--granite); }
.epdold p b { font-weight: 700; color: var(--bok-ink); } /* "Lyssna först" is the method; the rest of the line says why (Linh, 2026-10-23: "we should highlight lyssna först (maybe bold is enough)") */
.epdold .knappar { display: flex; gap: 8px; }
.epdold .knappar button { flex: 1; min-height: 44px; padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--blue-ink); background: transparent; color: var(--blue-ink); font-size: 15px; font-weight: 600; }

/* ---- Mening: a reading stage with a fixed anchor ----
   The story is one band high (--scen: the space between the bar and the player). The sentence being read always starts at ONE place in it: its first line at --anker, 38 % of the band down (a little above the middle: three lines of it end about
   at the middle, and a longer sentence grows downward into the room under it), and at the start edge of the text column, whatever its length, the speaker's name or what came before it. A sentence too long for the room under the anchor scrolls
   inside the stage, from the anchor, and is never cut or centred again (js/reader.js mark() puts the stage's own scroll back to the top at every sentence). The text is start-aligned, as in Hela texten (mirrored in right-to-left).
   The stage is a grid of two rows: row 1 is the room above the anchor, where the sentence before hangs, its last line a fixed gap above the sentence (it takes nothing from the sentence; taller than the room it is clipped at the top of the stage,
   softly; at most about three lines of it are shown), row 2 is the sentence. What stands above the first line inside the sentence's own box (a situation's speaker name, the bubble's padding, the same speaker's faint line) is --over, measured
   by js/reader.js forraMaet(): the paragraph is pulled up by it, so the LINE is at the anchor and the box hangs around it.
   The page does not scroll to follow the sentence (mark(): only the learner's own ▶, ◀, ▶▶ and seek bring the stage into the band, never the audio moving on). What comes after the story (the words, "Fraser i avsnittet", the end card) starts below the stage.
   The 96px under the stage keep what follows it out of the strip that opens between the stage and the player when Safari's toolbar slides away (the stage is as high as the screen with the toolbar out, 100svh; the player goes down with the screen's edge).
   (Linh's iPhone, 2026-10-23. Round 1: "a fixed position ... the one sentence in the middle of the screen and avoid having Fraser i avsnittet appear in that while audio is running". Round 3: "the main text should always start from same position when new
   sentence comes to avoid text jumping around", "text in story should be right align, not centered" (read as: not centred, aligned like ordinary text, so start), "in situation ... the box keep changing size depending on the coming text") */
#readView { --anker: calc(var(--scen) * .38); }
#readView .story.mode-1 { --forrakap: 116px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--anker) auto; align-content: start; align-items: start; justify-items: stretch; height: var(--scen); overflow-y: auto; margin: 0 auto 96px; text-align: start; font-size: 30px; line-height: 1.35; scroll-margin-top: var(--topp); }
/* the stage's top edge: what hangs above the anchor and is taller than the room is cut here, so it fades into the page (sticky, so it stays at the top of the stage while a long sentence is scrolled in it) */
.story.mode-1::after { content: ""; grid-row: 1; grid-column: 1; align-self: start; position: sticky; top: 0; z-index: 2; height: 30px; background: linear-gradient(var(--bok), transparent); pointer-events: none; }
.story.mode-1 .repliker { display: contents; text-align: inherit; }
#readView .story.mode-1 p { text-indent: 0; }
.story.mode-1 p:not(.has-now):not(.has-forra) { display: none; }
.story.mode-1 p.has-forra, .story.mode-1 p.has-now { display: block; }
#readView .story.mode-1:not(.samtal) p.has-forra, #readView .story.mode-1:not(.samtal) p.has-now { display: block; } /* (a reply of a run is display: contents on the page) */
/* the sentence being read: row 2, pulled up by what is above its first line, so the first line is at the anchor; it grows downward */
#readView .story.mode-1 p.has-now { grid-row: 2; grid-column: 1; position: relative; justify-self: stretch; margin: calc(-1 * var(--over, 0px)) 0 16px; }
/* the sentence before, in a paragraph of its own: it hangs above the sentence (row 1, its bottom edge a fixed gap above the paragraph being read) and never moves it; only its last lines are shown, the rest is cut and faded (the mask is the last --forrakap of its height) */
#readView .story.mode-1 p.has-forra:not(.has-now) { grid-row: 1; grid-column: 1; align-self: end; margin: 0 0 calc(22px + var(--over, 0px)); }
.story.mode-1 p.has-forra:not(.has-now), .story.mode-1:not(.samtal) p.has-now .sent.forra {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px); mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
  -webkit-mask-size: 100% var(--forrakap); mask-size: 100% var(--forrakap); -webkit-mask-position: 0 100%; mask-position: 0 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.story.mode-1 .sent.forra { display: block; font-size: 20px; line-height: 1.5; color: var(--bok-mjuk); }
.story.mode-1 > p:first-child::first-letter { float: none; font-size: inherit; padding: 0; color: inherit; }
/* nothing is being read (before ▶, and after the end): a line where the sentence will start says what the stage is for (js/reader.js applyMode sets data-tom) */
.story.mode-1:not(:has(.sent.now))::before { content: attr(data-tom); grid-row: 2; grid-column: 1; justify-self: stretch; max-width: 24ch; font-size: 17px; line-height: 1.45; color: var(--bok-mjuk); text-wrap: pretty; }
/* a story: the name and the sentence before hang above the sentence, out of the flow, so they take nothing from it */
.story.mode-1:not(.samtal) .said .who { display: none; }
.story.mode-1:not(.samtal) .said.has-now .who { display: block; }
.story.mode-1:not(.samtal) p.has-now .sent.forra { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 22px; }
.story.mode-1:not(.samtal) .said.has-now .who { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 8px; max-width: none; }
#readView .story.mode-1:not(.samtal):has(.said.has-now) p.has-forra:not(.has-now) { margin-bottom: calc(40px + var(--over, 0px)); }
.story.mode-1:not(.samtal):has(.said.has-now) p.has-now .sent.forra { margin-bottom: 40px; }
.story.mode-1:not(.samtal) p.has-now::after { content: ""; position: absolute; inset-inline-start: 0; top: 100%; width: 48px; height: 1px; margin: 26px 0 0; background: var(--bok-linje); }
/* in a situation: the sentence before as a small bubble above, the current one as its own large bubble of one fixed width on the speaker's side.
   The bubble: the others' from the start edge and the learner's own ([data-jag]) from the end edge, 84 % of the column wide (the inset the bubbles of Hela texten leave on the other side), whatever the text; it does not shrink to fit it.
   Its minimum height is three lines of the sentence (and the same speaker's faint line, if it is in the bubble), so most sentences never change its size; a longer one grows downward. The text starts at the top of it, the speaker's name is the
   row right above it (Linh's iPhone, 2026-10-23: "in sentence mode when the box keep changing size depending on the coming text, which is anoy to follow"). */
.story.samtal.mode-1 p.said.has-forra, .story.samtal.mode-1 p.said.has-now { display: grid; justify-items: start; gap: 4px; }
.story.samtal.mode-1 p.said[data-jag] { justify-items: end; }
.story.samtal.mode-1 .said:not([data-jag]) .who { display: flex; }
/* the sentence before: when ANOTHER speaker said it (or the narrator) it is a paragraph of its own, so it is its own small bubble above the current one, on its speaker's side, the name in the role colour, faded to --forra-op (Linh's iPhone, 2026-10-23:
   "the text from other people (previous sentence) is merged into same box as the current one ... we should have it outside if it is from another person"); a narrated one is a faded line (the soft ink). When the SAME speaker said it, it is in the same paragraph and stays a faint line inside the current bubble (below). */
#readView .story.samtal.mode-1 p.has-forra:not(.has-now) { margin-bottom: calc(14px + var(--over, 0px)); }
.story.samtal.mode-1 p.said.has-forra:not(.has-now) { --forrakap: 164px; }
.story.samtal.mode-1 p.has-forra:not(.has-now) .what { font-size: 20px; opacity: var(--forra-op); }
.story.samtal.mode-1 p.has-forra:not(.has-now) .sent.forra { color: inherit; }
.story.samtal.mode-1 .sent.forra { font-size: 20px; }
/* the faint line of the same speaker's sentence before is in this paragraph, above the sentence, at most three lines of it (the rest is left out with an ellipsis: it was just heard); the bubble grows upward by it and the first line stays at the anchor */
.story.samtal.mode-1 p.has-now .sent.forra { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.story.samtal.mode-1 p.has-now .what { width: 84%; max-width: none; min-height: calc(3 * 1.35em + 35px + var(--forrah, 0px)); padding: 16px 20px 17px; border-radius: 24px 24px 24px 8px; font-size: 28px; line-height: 1.35; }
.story.samtal.mode-1 p.has-now[data-jag] .what { border-radius: 24px 24px 8px 24px; }
.story.samtal.mode-1 > p.has-now:not(.said) { font-size: 24px; color: var(--bok-ink); }

/* ---- the player, docked above the tab bar ---- */
/* LAS-PANEL (2026-11-01, Linh's phone): the dock stands on the tab bar, whose height (--navh) is measured with the home bar's safe area in it (js/reader.js maetNav), and its bottom padding
   is how far the raised Hem button rises above the bar (--navut) and 4 px, so the button never covers the play button; the top padding is 10 px (14 before),
   so the dock is only 10 px taller than before HEM-LAS and the Dold card still fits above it at the top of a short screen */
.lasdock { position: fixed; z-index: 15; left: 0; right: 0; bottom: var(--navh, calc(64px + env(safe-area-inset-bottom, 0px))); padding: 10px 18px max(10px, calc(var(--navut, 0px) + 4px)); background: var(--bok-dock); border-top: 1px solid var(--bok-kant); box-shadow: 0 -10px 24px rgba(70, 50, 20, .07); }
.lasdock > * { max-width: 560px; margin-inline: auto; }
.lasdock .seek { display: grid; gap: 4px; }
.lasdock #seek { width: 100%; height: 24px; margin: -10px 0 -6px; padding: 0; border: 0; background: transparent; -webkit-appearance: none; appearance: none; }
.lasdock #seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--blue), var(--blue)) 0 0 / var(--pct, 0%) 100% no-repeat, var(--bok-kant); }
.lasdock #seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--blue); border: 2px solid var(--bok-dock); }
.lasdock #seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--bok-kant); }
.lasdock #seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--blue); }
.lasdock #seek::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--blue); border: 2px solid var(--bok-dock); }
.lasdock .nums { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--bok-mjuk); font-variant-numeric: tabular-nums; }
.lasdock #pausNot { flex: 1; text-align: center; }
.lasdock .knappar { display: grid; grid-template-columns: 1fr 1fr 1.3fr 1fr 1fr; justify-items: center; align-items: center; margin-top: 4px; }
.lasdock .knappar > button { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.lasdock .knappar svg { display: block; }
.lasdock #prev, .lasdock #next { border: 0; background: var(--bok-knapp); color: var(--bok-ink); }
.lasdock #play { width: 58px; height: 58px; border: 0; background: var(--blue); color: var(--on-blue); box-shadow: 0 3px 10px rgba(116, 63, 142, .32); }
.lasdock #loop, .lasdock #mic { border: 1.5px solid var(--bok-knappkant); background: transparent; color: var(--granite); }
.lasdock #loop[aria-pressed="true"] { border-color: var(--blue-ink); background: var(--blue-soft); color: var(--blue-ink); }
.lasdock #mic[aria-pressed="true"] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad-ink); }
#readView.slarupp .lasdock #play { background: var(--card); color: var(--blue-ink); box-shadow: inset 0 0 0 2px var(--blue); }
.lasdock button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
/* the note after a tap on När avsnittet är slut: 3 s, a status, above the player */
.slutnot { position: absolute; left: 14px; right: 14px; bottom: calc(100% + 10px); max-width: 420px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: 0 8px 22px rgba(0, 0, 0, .25); font-size: 15px; line-height: 1.35; }
.slutnot:empty { display: none; }
.slutnot svg { flex: none; }

/* ---- Säg meningen: the panel rises right above the player (tal.js paints into #sagBox as before) ---- */
.lasdock #sagBox { position: absolute; left: 14px; right: 14px; bottom: calc(100% + 10px); max-width: 420px; margin: 0 auto; display: grid; gap: 10px; padding: 10px 10px 12px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--bok-knappkant); box-shadow: 0 8px 22px rgba(70, 50, 20, .14); }
.lasdock #sagBox[hidden] { display: none; }
.lasdock #sagBox:has(.dot.rec) { border: 1.5px solid var(--bad); }
.lasdock #sagBox .sagrad { gap: 12px; }
.lasdock #sagBox .sagrad .mening { font-size: 24px; line-height: 1.35; }
.lasdock #sagBox .sagrad .mening .ja { font-weight: 700; }
.lasdock #sagBox .sagrad .mening .nej { color: var(--bok-mjuk); text-decoration: underline dotted var(--bok-mjuk) 2px; text-underline-offset: 5px; }
.lasdock #sagBox .sagrad .mening .nej.dold { text-decoration: none; }
.lasdock #sagBox .sagtips { padding-inline-end: 6px; font-size: 14px; line-height: 1.45; color: var(--granite); }
.lasdock #sagStopp { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--bad); color: var(--on-bad); font-size: 15px; font-weight: 700; }
.lasdock #sagBox .saghuvud { display: flex; align-items: center; gap: 10px; margin-bottom: -6px; }
.lasdock #sagBox .saghuvud > span { flex: 1; font-size: 14px; font-weight: 600; color: var(--granite); }
.lasdock #sagBox .saghuvud .pct { padding: 1px 9px; border-radius: 8px; background: var(--sunk); color: var(--granite); font-size: 15px; }
.lasdock #sagBox .saghuvud .pct.bra { background: var(--ok-soft); color: var(--ok-ink); }
.lasdock #sagBox .sagx { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--granite); display: grid; place-items: center; }
.lasdock #sagBox .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-inline-end: 6px; }
.lasdock #sagBox .row button { min-height: 44px; justify-content: center; border-radius: 12px; font-size: 15px; font-weight: 600; }
.lasdock #sagBox #sagIgen { grid-column: 1 / -1; min-height: 48px; font-size: 16px; font-weight: 700; }
.lasdock #sagBox #sagDig:only-child { grid-column: 1 / -1; }

/* ---- a tapped word: a sheet over the player, like an e-reader's dictionary (js/reader.js popover adds .ark) ---- */
#pop.ark { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; max-width: 560px; max-height: 78svh; overflow-y: auto; margin: 0 auto; display: grid; gap: 12px; padding: 8px 18px calc(26px + env(safe-area-inset-bottom)); border: 0; border-radius: 22px 22px 0 0; background: var(--bok-dock); color: var(--bok-ink); box-shadow: 0 -1px 0 var(--bok-kant), 0 -12px 32px rgba(70, 50, 20, .16); }
#pop.ark[hidden] { display: none; }
#pop.ark::before { content: ""; justify-self: center; width: 38px; height: 5px; border-radius: 3px; background: var(--bok-knappkant); }
#pop.ark .pop-paus { display: flex; align-items: center; gap: 6px; margin-top: -4px; font-size: 14px; font-weight: 600; color: var(--blue-ink); }
#pop.ark .pop-word { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 16px; }
#pop.ark .pop-word .ordet { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; font: 400 32px/1.1 var(--serif); }
#pop.ark .pop-word .tag.rad { margin: 0; padding: 1px 8px; border-radius: 6px; background: var(--bok-knapp); color: var(--granite); font: 600 14px/1.4 var(--sans); }
#pop.ark #popOrd { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--blue-soft); color: var(--blue-ink); display: grid; place-items: center; }
#pop.ark #popStang { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--granite); display: grid; place-items: center; }
#pop.ark .pop-en { margin: 0; font-size: 18px; line-height: 1.35; }
#pop.ark .pop-andra { margin: -6px 0 0; }
/* VI-ORD D5 (vi-knapp.md 8.2): the `+ VI` row, always on its own row (Linh 2026-11-10), after the meaning lines and before the example */
#pop.ark .pop-vi { margin: 0; justify-self: start; display: flex; align-items: center; min-height: 32px; }
#pop.ark .viHamta { font: 600 14px/1.4 var(--sans); padding: 5px 12px; margin: 0; min-height: 0; border: 1px solid var(--blue-ink); color: var(--blue-ink); }
#pop.ark .viHamta[aria-disabled="true"] { border-color: var(--bok-knappkant); color: var(--granite); }
#pop.ark .viHamta::after { content: ""; position: absolute; inset-block: -8px; inset-inline: -8px; }
#pop.ark .viStatus { font-size: 14px; line-height: 1.4; }
#pop.ark .pop-andra:focus { outline: none; } #pop.ark .pop-andra:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
#pop.ark .pop-vi + .pop-ex { margin-top: 0; }
#pop.ark .pop-ex { margin: -6px 0 0; font-size: 17px; line-height: 1.45; color: var(--granite); }
#pop.ark .pop-save { margin: 0; min-height: 48px; border-radius: 12px; font-size: 16px; font-weight: 700; }
#pop.ark .tag.sparad { margin: 0; }
#pop.ark .pop-acts.ikoner { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
#pop.ark .pop-acts.ikoner button { min-height: 60px; display: grid; justify-items: center; align-content: center; gap: 4px; padding: 6px 4px; border-radius: 12px; border: 1.5px solid var(--bok-knappkant); background: none; color: var(--bok-ink); font-size: 14px; font-weight: 600; line-height: 1.2; white-space: normal; text-align: center; }
#pop.ark .pop-acts.ikoner svg { color: var(--blue-ink); }
#pop.ark .pop-sent { margin: 0; padding-top: 10px; border-top: 1px solid var(--bok-kant); font-size: 15px; line-height: 1.4; font-style: italic; color: var(--granite); }
#pop.ark .pop-tal { margin: 0; border-top-color: var(--bok-kant); }

/* ---- the settings sheet: Text, Tempo, Längd and Det här avsnittet ---- */
.lasarkbak { position: fixed; inset: 0; z-index: 45; background: rgba(20, 22, 26, .42); }
.lasark { position: fixed; z-index: 46; left: 0; right: 0; bottom: 0; max-width: 560px; max-height: 88svh; overflow-y: auto; margin: 0 auto; display: grid; gap: 14px; padding: 8px 18px calc(26px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink); box-shadow: 0 -8px 30px rgba(0, 0, 0, .18); }
.lasark[hidden], .lasarkbak[hidden] { display: none; }
.lasark::before { content: ""; justify-self: center; width: 38px; height: 5px; border-radius: 3px; background: var(--line); }
.lasark .arkhuvud { display: flex; align-items: center; justify-content: space-between; margin-top: -6px; }
.lasark h2 { margin: 0; font: 400 24px/1.2 var(--serif); outline: none; }
.lasark #lasArkKlar { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--blue-ink); font-size: 16px; font-weight: 600; }
.lasark .grupp { display: grid; gap: 7px; }
.lasark .glbl { font-size: 14px; font-weight: 600; color: var(--granite); }
.lasark .rmodes { display: flex; padding: 0; }
.lasark .rmodes .seg { flex: 1; }
.lasark .rmodes .seg button { flex: 1; min-height: 44px; }
.lasark .temporow { display: flex; align-items: center; gap: 10px; }
.lasark .temporow .riconbtn { width: 44px; height: 44px; border-radius: 50%; font-size: 20px; line-height: 1; }
.lasark .temporow input[type=range] { flex: 1; min-width: 0; height: 28px; padding: 0; border: 0; -webkit-appearance: none; appearance: none; background: transparent; }
.lasark .temporow input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
.lasark .temporow input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--blue); border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.lasark .temporow input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.lasark .temporow input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); border: 2px solid var(--card); }
.lasark #rateVal { min-width: 50px; text-align: end; font-size: 16px; font-variant-numeric: tabular-nums; }
.lasark #epLen { padding: 0; }
.lasark .grupp:has(> #epLen[hidden]) { display: none; }
/* the episode's own buttons as rows: Om berättelsen, Redigera / Rapportera / Ta bort texten (each one only where it shows today) */
.lasark .lista { display: grid; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lasark .lista #epActions { display: grid; margin: 0; } /* (app.css .actions has a margin of its own) */
.lasark .lista button { width: 100%; min-height: 50px; min-block-size: 50px; max-inline-size: none; margin: -1px 0 0; display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 0 12px 0 14px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--ink); font-size: 16px; font-weight: 400; text-align: start; }
.lasark .lista button svg { width: 20px; height: 20px; flex: none; color: var(--granite); }
.lasark .lista #delCustom { color: var(--bad-ink); }
.lasark .grupp.avsnittet:not(:has(#epActions button)) { display: none; } /* (@dev: the list's own buttons; PIN-2: the pin left this sheet for the top bar) */

[dir="rtl"] .lasdock #prev svg, [dir="rtl"] .lasdock #next svg, [dir="rtl"] .lasdock #play svg { transform: scaleX(-1); }
@media (prefers-reduced-motion: reduce) { .rtopp { transition: none; } }
