/* Lessons. Colours and type come from ../shared/theme.css.
   The aliases below are kept because the rest of this file grew up with them;
   they now point at the site's temple-stone palette.

   There is no dark cut of this page. A map is read in daylight, and the rest
   of the site has none either — the landing and the flashcards have always
   been light-only, so a lessons screen that flipped with the system was the
   odd one out rather than the considerate one. */
:root{
  --green:#0E8585; --green-d:#0B6B6B; --green-l:#CFE9E7; --green-t:#0B6B6B;
  --blue:#2F4FA0; --blue-d:#263F80;
  --red:#BE1559; --red-d:#9C0F49; --red-l:#FBD9E7; --red-t:#9C0F49;
  --yellow:#D4A017; --purple:#6B3F72; --orange:#C1662F;
  --ink:#16211C; --ink-2:#3C4A42; --grey:#74837A; --grey-l:#D6DCCC; --grey-bg:#EEF0E8;
  --sheet:#F8F9F3;
  --wing:#D6DCCC;
  --radius:2px;
}

/* The lesson screen after dark. These aliases grew up holding their own hex
   rather than pointing at the theme, so this is where they are answered —
   same names, same jobs, a ground that has moved. The pale washes behind a
   right and a wrong answer invert outright: their work is to be a tint of
   the paper, and the paper is dark now. */
/* Written twice; see shared/theme.css for why. Keep the two in step. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --green:#3FB6B6; --green-d:#5FCACA; --green-l:#10302F; --green-t:#8FD8D8;
    --blue:#7F9AE0; --blue-d:#9FB3EA;
    --red:#E05A86; --red-d:#EA7BA0; --red-l:#3A1424; --red-t:#F0A0BC;
    --yellow:#DFB551; --purple:#B48CC0; --orange:#E09A62;
    --ink:#E8ECE7; --ink-2:#C2CAC4; --grey:#8C968F; --grey-l:#38423B; --grey-bg:#131815;
    --sheet:#1A211D;
    --wing:#38423B;
    /* The wash behind a chosen answer, which in daylight is the palest blue
       there is and after dark has to be the deepest. */
    --sel-bg:#1B2537;
  }
}

  :root[data-theme="dark"]{
    --green:#3FB6B6; --green-d:#5FCACA; --green-l:#10302F; --green-t:#8FD8D8;
    --blue:#7F9AE0; --blue-d:#9FB3EA;
    --red:#E05A86; --red-d:#EA7BA0; --red-l:#3A1424; --red-t:#F0A0BC;
    --yellow:#DFB551; --purple:#B48CC0; --orange:#E09A62;
    --ink:#E8ECE7; --ink-2:#C2CAC4; --grey:#8C968F; --grey-l:#38423B; --grey-bg:#131815;
    --sheet:#1A211D;
    --wing:#38423B;
    /* The wash behind a chosen answer, which in daylight is the palest blue
       there is and after dark has to be the deepest. */
    --sel-bg:#1B2537;
  }


*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--serif,"Noto Serif Thai",Georgia,serif);
  font-weight:600;
  color:var(--ink);
  background-color:var(--grey-bg);
  background-image:var(--lattice);
  overscroll-behavior:none;
}
button{font-family:inherit;font-weight:600;cursor:pointer;border:0;background:none;color:inherit}
#app{min-height:100%;display:flex;flex-direction:column}

/* ---------- buttons: flat, ruled, square ---------- */
.btn{
  display:block;width:100%;padding:14px 16px;border-radius:var(--radius);
  font-size:15px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;
  color:var(--sheet);background:var(--ink);border:1px solid var(--ink);
  transition:background .12s,color .12s;
}
.btn:hover:not(:disabled){background:var(--red);border-color:var(--red)}
.btn:disabled{background:transparent;border-color:var(--grey-l);color:var(--grey);cursor:default}
.btn.red{background:var(--red);border-color:var(--red)}
.btn.ghost{background:transparent;color:var(--grey);border:1px solid var(--grey-l)}

/* ---------- path screen ---------- */
/* The bar spans the window, because a bar that stops short of the edge is a
   box; what it holds does not. On a wide screen the streak used to sit in
   one far corner and the account in the other, a yard either side of a map
   460px wide, as though the three had nothing to do with each other. */
.top{
  position:sticky;top:0;z-index:20;
  padding:12px 18px;background-color:var(--sheet);
  border-bottom:1px solid var(--grey-l);box-shadow:0 3px 0 -2px var(--grey-l);
}
.top-in{
  display:flex;gap:26px;align-items:center;
  max-width:760px;width:100%;margin:0 auto;
}
.stat{display:flex;align-items:center;gap:9px}
.stat-val{display:block;font-size:15px;font-weight:700;line-height:1.2;white-space:nowrap}
.stat-label{
  display:block;font-size:10px;font-weight:600;letter-spacing:.12em;
  text-transform:uppercase;color:var(--grey);
}
.top-in .spacer{flex:1}

.hero{max-width:560px;margin:0 auto;padding:30px 18px 0;text-align:center}
.hero h1{font-family:var(--display);font-size:32px;font-weight:600;margin:0 0 8px;letter-spacing:.01em}
.hero p{color:var(--grey);font-size:15px;font-weight:600;margin:0}

/* ---------- the journey ----------
   One road down the page, nine places on it. The leg is the positioning box:
   the SVG inside it keeps its aspect ratio at any width and the waypoints are
   placed in percentages of the same box, so road and buttons scale together
   and never drift apart. */
/* The map is a sheet laid on the table, and it used to keep a daylight
   ground in both themes on the grounds that a map is read in daylight. In a
   dark window that was one cream rectangle glowing in the middle of the
   night — the brightest thing on the screen, and the thing you look at
   longest. It takes the theme now like everything else. The sheet is still a
   sheet: a shade lighter than the wall behind it, with the lattice on it. */
.journey{
  position:relative;
  max-width:460px;width:100%;margin:0 auto;
  padding:44px 16px 150px;
  color:var(--ink);
  /* The daylight value is the fallback in the var(), NOT a declaration on
     this element: a custom property set here beats the one the theme sets
     on :root for everything inside, which is how the sheet stayed cream in
     a dark window while the cards on it went black. */
  background:var(--sheet-tint,#F6F2E3) var(--lattice-firm);
  border-left:1px solid var(--grey-l);
  border-right:1px solid var(--grey-l);
  box-shadow:0 0 36px -22px rgba(0,0,0,.55);
}
@media (min-width:1100px){
  /* The scroll takes a little more of the wall. The road is an SVG scaled to
     its column and the stops are placed in percentages of the same box, so
     the two widen together and nothing has to be redrawn. */
  .journey{max-width:540px}
}

/* A kranok band closes the sheet at each end, the way a scroll is bound. */
.journey:before,.journey:after{
  content:"";position:absolute;left:0;right:0;height:18px;
  background:var(--kranok-band) repeat-x center/auto 18px;
}
.journey:before{top:12px}
.journey:after{bottom:96px}
.leg{position:relative}

.road{display:block;width:100%;height:auto}
.road-ahead{
  fill:none;stroke:var(--road-ahead,#A8A288);stroke-width:3.2;stroke-linecap:round;
  stroke-dasharray:1 9;                 /* a track, not a pipe */
}
.road-walked{
  fill:none;stroke:var(--gold);stroke-width:4;stroke-linecap:round;
}

/* ---------- a place ---------- */
/* A sign at the stop, not a floating caption: it carries a background so the
   road passes behind it instead of through the words. The road is drawn in
   viewBox units and the sign in CSS pixels, so their scales drift apart as
   the column changes width — an opaque panel is the one thing that hides the
   road cleanly at every size. */
.place{
  position:absolute;transform:translate(-50%,-50%);
  width:min(94%,320px);text-align:center;pointer-events:none;
  padding:16px 18px 18px;
  background:var(--sheet);
  border:1px solid var(--grey-l);
  border-top:2px solid var(--unit,var(--red));
  border-radius:var(--radius);
}
/* The seal is the one piece of flat colour a unit gets: a stamped square with
   the letter the place begins with, the way a document is sealed rather than
   headed. */
.place-seal{
  display:inline-grid;place-items:center;width:46px;height:46px;
  margin-top:-40px;                     /* straddles the top edge, like a stamp */
  /* The ring behind it is the card's colour; the letter on it is not. A
     seal is a saturated block whatever the theme, so its ink stays near
     white instead of following the paper into the dark. */
  background:var(--unit,var(--red));color:var(--seal-ink,var(--sheet));
  font-family:var(--display);font-size:24px;font-weight:600;line-height:1;
  border-radius:var(--radius);
  box-shadow:0 0 0 1px var(--sheet), 0 0 0 4px var(--unit,var(--red));
}
.place-icon{
  width:28px;height:28px;
  fill:none;stroke:currentColor;stroke-width:1.5;
  stroke-linecap:round;stroke-linejoin:round;
}
.place-name{margin-top:10px;display:flex;align-items:baseline;justify-content:center;gap:10px;flex-wrap:wrap}
.place-th{font-family:var(--display);font-size:27px;font-weight:600;line-height:1.5;color:var(--ink)}
.place-rom{font-size:13px;font-weight:600;color:var(--grey)}
.place-en{margin-top:2px;font-size:13px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--unit,var(--red))}
/* The kranok mark, shrunk, doing the work a rule would do inside the sign. */
.place-flourish{
  display:block;width:56px;height:12px;margin:8px auto 0;
  background:var(--kranok-mark) center/56px 12px no-repeat;
  opacity:.85;
}
.place-note{margin-top:6px;font-size:13px;font-weight:600;color:var(--grey);font-style:italic}
.place-topic{
  margin-top:9px;display:inline-block;padding:4px 11px;
  border:1px solid var(--grey-l);border-radius:var(--radius);
  font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-2);
  background:var(--sheet);
}

/* ---------- a waypoint ---------- */
/* The marker sits on the road, so it is the diamond that is centred on the
   point — not the button. Centring the whole button would drag the diamond
   off the road by half the label's width, and the longer the lesson title
   the further off it would sit. 22px is half the diamond. */
.stop{
  position:absolute;
  display:flex;align-items:center;gap:11px;text-align:left;padding:0;
  transform:translate(-22px,-50%);
}
.stop.left{
  flex-direction:row-reverse;
  transform:translate(calc(-100% + 22px),-50%);
}
.stop.left .stop-label{text-align:right}

/* A marker set into the road rather than a bubble floating over it. The
   diamond is the pseudo-element, so the Thai numeral inside stays upright —
   rotating the box would have turned the digit on its corner too. */
.stop-dot{
  position:relative;isolation:isolate;flex:none;
  display:grid;place-items:center;width:44px;height:44px;
  color:var(--grey);font-family:var(--display);font-size:16px;font-weight:600;line-height:1;
}
.stop-dot:before{
  content:"";position:absolute;inset:5px;z-index:-1;
  border:1px solid var(--grey-l);border-radius:2px;background:var(--sheet);
  transform:rotate(45deg);
  transition:border-color .12s,background .12s,box-shadow .12s;
}
/* The label is tied to its marker rather than floating beside it: a plaque
   on the roadside with a short tie across the gap to the diamond. Being
   opaque, it also masks the road behind it, which the text halo used to do
   by approximation. */
.stop-label{
  position:relative;display:block;min-width:0;
  padding:7px 11px;
  border:1px solid var(--grey-l);border-radius:var(--radius);
  background:var(--sheet);
}
.stop-label:before{
  content:"";position:absolute;top:50%;width:11px;height:2px;margin-top:-1px;
  background:var(--grey-l);
}
.stop.right .stop-label:before{left:-11px}
.stop.left .stop-label:before{right:-11px}
/* The notch: the plaque grows out of the marker rather than sitting beside
   it. Two borders only, so it reads as a corner of the plaque pulled out. */
.stop-label:after{
  content:"";position:absolute;top:50%;width:10px;height:10px;margin-top:-5px;
  transform:rotate(45deg);background:var(--sheet);
}
.stop.right .stop-label:after{
  left:-6px;border-left:1px solid var(--grey-l);border-bottom:1px solid var(--grey-l);
}
.stop.left .stop-label:after{
  right:-6px;border-right:1px solid var(--grey-l);border-top:1px solid var(--grey-l);
}
.stop-name{display:block;font-size:14px;font-weight:600;color:var(--ink-2);white-space:nowrap}
.marks{display:flex;gap:5px;margin-top:6px}
.stop.left .marks{justify-content:flex-end}
/* Six pixels is a speck. These are the only record on the map of how many
   times a stop has been walked, so they are set at a size that can be
   counted without leaning in. */
.mark{
  width:9px;height:9px;border:1px solid var(--grey-l);border-radius:var(--radius);
  background:var(--grey-bg);
}
.mark.on{background:var(--gold);border-color:var(--gold)}

.stop.walked .stop-dot{color:var(--unit,var(--red))}
.stop.walked .stop-dot:before{border-color:var(--unit,var(--red))}
.stop-dot.full{color:var(--seal-ink,var(--sheet))}
.stop-dot.full:before{background:var(--unit,var(--red));border-color:var(--unit,var(--red))}
.stop:hover .stop-dot{color:var(--ink)}
.stop:hover .stop-dot:before{border-color:var(--ink-2)}
.stop:hover .stop-name{color:var(--ink)}
.stop:hover .stop-label{border-color:var(--ink-2)}
.stop:hover .stop-label:before{background:var(--ink-2)}
.stop:hover .stop-label:after{border-color:var(--ink-2)}

/* Where you are: the same plaque as every other stop, with a rule under the
   title. It used to be a filled magenta button with a halo round its marker,
   which left one stop on the map shouting in a colour nothing else on the
   sheet used. A line under the name and the arrow after it say the same
   thing, and the map keeps one palette. */
.stop.here .stop-name{
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:4px;
}
.cue{margin-left:8px;font-weight:600;opacity:.7}

/* A stop not yet reached. Still drawn, still readable, still where it will
   be when it opens -- the map is the promise, and greying the rest of the
   country out would hide what the course is. It simply does not respond:
   no hover, and a padlock where the numeral goes. */
.stop.shut{cursor:not-allowed}
.stop.shut .stop-dot,
.stop.shut .stop-name{color:var(--grey)}
.stop.shut .stop-label{opacity:.72}
.stop.shut:hover .stop-dot{color:var(--grey)}
.stop.shut:hover .stop-dot:before{border-color:var(--grey-l)}
.stop.shut:hover .stop-name{color:var(--grey)}
.stop.shut:hover .stop-label{border-color:var(--grey-l)}
.stop.shut:hover .stop-label:before{background:var(--grey-l)}
.stop.shut:hover .stop-label:after{border-color:var(--grey-l)}
.stop-dot .lock{
  width:12px;height:14px;fill:none;
  stroke:currentColor;stroke-width:1.1;
  stroke-linecap:round;stroke-linejoin:round;
}

/* The line under the hero when nobody is signed in. */
.hero-gate{margin:12px 0 0 !important;font-weight:400 !important;color:var(--grey) !important}
.hero-gate-go{
  font:inherit;font-weight:600;color:var(--red);
  background:none;border:0;padding:0;cursor:pointer;
  text-decoration:underline;text-underline-offset:3px;
}
.hero-gate-go:hover{color:var(--ink)}

@media (max-width:420px){
  .journey{padding-left:8px;padding-right:8px}
  .stop-name{font-size:13px}
  .place-th{font-size:24px}
}

.path-foot{
  max-width:560px;margin:0 auto;padding:10px 18px 56px;text-align:center;
}
.path-reset{
  font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;
  color:var(--grey);border-bottom:1px solid transparent;padding:4px 2px;
}
.path-reset:hover{color:var(--red);border-bottom-color:var(--red)}

/* The ask on the finish screen. Set as a quiet panel rather than a banner:
   the lesson was just finished, and the thing to feel first is that, not a
   request. */
.keep{
  margin:30px auto 0;max-width:420px;padding:18px 18px 20px;text-align:center;
  border:1px solid var(--grey-l);border-radius:var(--radius);background:var(--sheet);
}
.keep h4{
  margin:0 0 7px;font-size:11px;font-weight:600;letter-spacing:.14em;
  text-transform:uppercase;color:var(--grey);
}
.keep p{margin:0 0 14px;font-size:14px;font-weight:400;line-height:1.6;color:var(--ink-2)}
.keep .btn{max-width:260px;margin:0 auto}

/* The sign for the next city, on the screen that finishes a unit. Set on
   the map's own daylight paper, because that is where a road sign belongs —
   the same card you will scroll past a minute later, met early. */
.arrival{margin:34px auto 0;max-width:420px}
.arr-head{
  margin:0 0 12px;font-size:11px;font-weight:600;letter-spacing:.14em;
  text-transform:uppercase;color:var(--grey);text-align:center;
}
.arr-place{
  padding:20px 18px 18px;background:var(--sheet);
  border:1px solid var(--grey-l);border-top:3px solid var(--unit,var(--red));
  border-radius:var(--radius);text-align:center;
  animation:arrive .5s ease-out both;
}
@keyframes arrive{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}

/* The words the lesson was about, under the three cards that say how it
   went. Set as a list rather than a grid: the English is what makes a word
   worth reading back, and a column of it reads faster than a table. */
.met-words{margin:30px auto 0;max-width:420px;text-align:left}
.met-words h4{
  margin:0 0 10px;font-size:11px;font-weight:600;letter-spacing:.14em;
  text-transform:uppercase;color:var(--grey);text-align:center;
}
.met-words ul{list-style:none;margin:0;padding:0;border-top:1px solid var(--grey-l)}
.met-words li{
  display:flex;align-items:baseline;gap:10px;padding:7px 2px;
  border-bottom:1px solid var(--grey-l);
}
.met-words .m-th{flex:none;font-size:19px;line-height:1.5}
.met-words .m-rom{flex:none;font-size:12px;color:var(--grey)}
.met-words .m-en{margin-left:auto;font-size:14px;color:var(--ink-2);text-align:right}
.met-more{margin:10px 0 0;font-size:13px;color:var(--grey);text-align:center}

/* Quiet on purpose: it is there for the one learner in fifty who spots a
   mistake, and must not look like part of the exercise to the other
   forty-nine. */
.ask-link{
  display:block;margin:14px auto 0;max-width:700px;text-align:center;
  font-size:12px;color:var(--grey-l);text-decoration:none;
}
.ask-link:hover{color:var(--red);text-decoration:underline}

/* The typing box. Set in the same serif at the same size as the word it is
   standing in for, so what you type looks like the thing you are typing. */
.type-in{
  display:block;width:100%;max-width:420px;margin:26px auto 0;
  padding:12px 14px;border:1px solid var(--grey-l);border-radius:var(--radius);
  background:var(--sheet);color:var(--ink);
  font-family:inherit;font-size:22px;font-weight:600;line-height:1.5;text-align:center;
  transition:border-color .12s;
}
.type-in::placeholder{color:var(--grey-l);font-weight:600}
.type-in:focus{outline:none;border-color:var(--blue)}
.type-in:disabled{background:transparent;color:var(--ink-2)}

/* ---------- the romanisation switch ----------
   A box that fills rather than a sliding track, which is the one shape for on
   and off the rest of the site uses. The example beside it is the setting
   demonstrating itself: it is the thing that appears and disappears. */
.btn-toggle{
  display:inline-flex;align-items:center;gap:9px;padding:6px 12px;
  border:1px solid var(--grey-l);border-radius:var(--radius);
  background:transparent;color:var(--grey);font-size:13px;font-weight:600;
  transition:border-color .12s,color .12s;
}
.btn-toggle:hover{border-color:var(--red);color:var(--ink-2)}
.toggle-box{
  flex:none;width:14px;height:14px;border:1px solid var(--grey);
  border-radius:var(--radius);background:transparent;transition:background .12s;
}
.btn-toggle.on{border-color:var(--red);color:var(--ink-2)}
.btn-toggle.on .toggle-box{background:var(--red);border-color:var(--red)}
.toggle-eg{color:var(--grey);font-size:12px;opacity:.75}
.btn-toggle.on .toggle-eg{color:var(--red);opacity:1}
.hero .btn-toggle{margin-top:18px}
/* In the lesson bar it has no room for a sentence, so the example is the
   label: a line of Paiboon that is either lit or not. */
.btn-toggle.compact{flex:none;padding:5px 9px;gap:7px}

/* Off, every transcription that sits beside Thai as a reading aid goes. The
   romanisation task keeps its options: there the transcription is the
   question, not the help. */
.lesson.rom-off .big-rom,
.lesson.rom-off .o-rom,
.lesson.rom-off .t-rom,
.lesson.rom-off .p-rom,
.lesson.rom-off .bubble .rom{display:none}

/* ---------- lesson shell ----------
   The lattice used to stop at the door of a lesson, on the grounds that
   behind an exercise it competes with the one Thai word you are being asked
   to read. It does — under the word. So the ground keeps the pattern and the
   exercise sits on a sheet laid over it, the way the map sets a place on one:
   flat paper under the ink, the site's own paper around it. */
.lesson{
  display:flex;flex-direction:column;min-height:100vh;min-height:100dvh;
  background-color:var(--grey-bg);background-image:var(--lattice);
}
.lesson-top{display:flex;align-items:center;gap:14px;padding:14px 18px;max-width:700px;width:100%;margin:0 auto}
.close{font-size:24px;color:var(--grey);line-height:1;padding:0 4px}
.close:hover{color:var(--red)}
.bar{flex:1;height:8px;border-radius:var(--radius);background:var(--grey-l);overflow:hidden}
.bar>i{display:block;height:100%;background:var(--red);transition:width .3s}
.step-count{
  flex:none;font-size:12px;font-weight:600;letter-spacing:.1em;color:var(--grey);
  font-variant-numeric:tabular-nums;
}

/* The exercise is vertically centred in what is left between the progress
   bar and the footer, so a three-line question does not sit at the top of a
   screen with half of it empty underneath. */
.stage{
  flex:1;max-width:700px;width:100%;margin:0 auto;
  padding:14px 18px calc(150px + env(safe-area-inset-bottom));
  display:flex;flex-direction:column;justify-content:center;
}
/* The lesson's own name, above the sheet rather than on it: it answers
   "where am I" and is not part of the question being asked. */
.where{
  margin:0 0 10px;font-size:11px;font-weight:600;letter-spacing:.14em;
  text-transform:uppercase;color:var(--grey);text-align:center;
}
.exercise{
  background:var(--sheet);border:1px solid var(--grey-l);
  border-top:3px solid var(--red);border-radius:var(--radius);
  padding:24px 26px 30px;box-shadow:0 3px 0 -2px var(--grey-l);
}
.q{font-size:22px;font-weight:700;margin:0 0 22px}

.prompt{display:flex;align-items:center;gap:14px;margin-bottom:26px}
.speaker{
  flex:none;width:54px;height:50px;border-radius:var(--radius);
  border:1px solid var(--blue);background:transparent;
  display:grid;place-items:center;color:var(--blue);
  transition:background .12s,color .12s,transform .08s;
}
.speaker:hover{background:var(--blue);color:var(--sheet)}
.speaker:active{transform:translateY(1px)}
.sp-ic{width:22px;height:19px;fill:none;stroke:currentColor;stroke-width:1.6;
  stroke-linecap:round;stroke-linejoin:round}
.sp-ic path:first-child{fill:currentColor}
/* Where listening is the task rather than an aside, the button says so and
   is sized to be the thing on the page you reach for. */
.speaker.big{
  width:auto;height:auto;min-width:168px;padding:16px 26px;margin:26px auto 4px;
  display:flex;align-items:center;justify-content:center;gap:12px;
}
.speaker.big .sp-ic{width:28px;height:24px}
.sp-label{font-size:14px;font-weight:600;letter-spacing:.14em;text-transform:uppercase}
.bubble{
  position:relative;border:1px solid var(--grey-l);border-radius:var(--radius);
  padding:12px 16px;background:var(--sheet);
}
.bubble:before{content:"";position:absolute;left:-7px;top:18px;width:12px;height:12px;
  background:var(--sheet);border-left:1px solid var(--grey-l);border-bottom:1px solid var(--grey-l);
  transform:rotate(45deg)}
.th{font-size:26px;font-weight:600;line-height:1.5}
.rom{font-size:14px;color:var(--grey);margin-top:4px}

/* A Thai word can be คอมพิวเตอร์ as easily as ดี, so this is sized to the
   viewport and allowed to wrap rather than set at one heroic size. */
.big-th{text-align:center;font-size:clamp(34px,9vw,58px);font-weight:600;
  line-height:1.45;margin:10px 0 4px;overflow-wrap:anywhere}
.big-rom{text-align:center;font-size:19px;color:var(--grey);margin-bottom:26px}
.en-prompt{font-size:25px;font-weight:600;margin:18px 0 28px;line-height:1.35}

/* An introduction has no options to read, so the meaning is the thing on the
   page: centred under the word, in the sheet's own serif, large enough that
   it is what you remember afterwards. */
.teach-en{text-align:center;font-size:24px;font-weight:600;line-height:1.35;
  margin:0 0 24px}
.teach-en + .ex-note{margin:0 auto 22px;max-width:30em}
/* Who says it, on the line with the English rather than under it: the prompt
   is “thank you (said by a man)”, and the bracket is as much a part of what
   you are being asked for as the words are. */
.en-who{display:inline-block;margin-left:9px;font-size:15px;font-weight:600;color:var(--grey);white-space:nowrap}

/* What a gloss leaves out, and the lesson would be wrong without: who says
   the sentence — ขอบคุณครับ and ขอบคุณค่ะ are both “thank you” — or the trap in
   the word. It decides the answer, so it is set against the margin like an
   editor's note rather than dropped underneath as a footnote. */
.ex-note{
  margin:-8px 0 22px;padding:3px 0 3px 12px;max-width:34em;
  border-left:2px solid var(--gold);
  font-size:14px;line-height:1.55;color:var(--grey);font-weight:600;
}
.en-prompt + .ex-note{margin-top:-20px}
.prompt + .ex-note{margin-top:14px}

/* option tiles */
.opts{display:grid;gap:12px}
.opts.cols{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}
.opt{
  display:flex;align-items:center;gap:12px;text-align:left;
  padding:14px 16px;border:1px solid var(--grey-l);border-radius:var(--radius);
  background:var(--sheet);font-size:17px;font-weight:600;transition:border-color .1s,background .1s;
}
.opt .num{width:22px;height:22px;border:1px solid var(--grey-l);border-radius:var(--radius);
  display:grid;place-items:center;font-size:11px;color:var(--grey)}
/* Stacked on purpose, not by luck: these used to land on separate lines
   only because the tile was too narrow to hold them side by side. */
.opt .o-th{display:block;font-size:20px;line-height:1.5}
.opt .o-rom{display:block;font-size:13px;color:var(--grey);font-weight:600}
.opt .o-en{display:block;margin-top:2px;font-size:13px;line-height:1.35;
  color:var(--grey);font-weight:400}
.opt:hover{border-color:var(--ink-2)}
.opt:active{transform:translateY(1px)}
.opt.sel{border-color:var(--blue);background:var(--sel-bg,#E6EDF3);color:var(--blue-d)}
.opt.sel .num{border-color:var(--blue);color:var(--blue-d)}
.opt.ok{border-color:var(--green);background:var(--green-l);color:var(--green-t)}
.opt.bad{border-color:var(--red);background:var(--red-l);color:var(--red-t)}

/* word bank build */
/* One line, dashed, so that an empty answer looks like somewhere to put
   words rather than like a rule someone forgot to remove. */
.slots{min-height:96px;margin-bottom:10px;display:flex;align-items:flex-start}
.slot-line{
  flex:1;border-bottom:2px dashed var(--grey-l);min-height:62px;
  display:flex;flex-wrap:wrap;align-content:flex-start;gap:8px;padding:6px 0 10px;
}
.bank{display:flex;flex-wrap:wrap;gap:10px;margin-top:24px;justify-content:center}
.tile{
  padding:9px 14px;border:1px solid var(--grey-l);border-radius:var(--radius);
  background:var(--sheet);font-size:19px;font-weight:600;line-height:1.5;
}
.tile:hover{border-color:var(--ink-2)}
.tile:active{transform:translateY(1px)}
.tile{transition:border-color .12s,transform .08s}
.tile .t-rom{display:block;font-size:11px;color:var(--grey);text-align:center;margin-top:1px}
.tile.used{opacity:.3;border-style:dashed;background:transparent;color:transparent}
.tile.used .t-rom{color:transparent}

/* pair matching */
.pairs{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.pair{
  padding:14px 10px;border:1px solid var(--grey-l);border-radius:var(--radius);
  background:var(--sheet);font-size:18px;font-weight:600;line-height:1.5;text-align:center;min-height:60px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
}
.pair:hover{border-color:var(--ink-2)}
.pair:active{transform:translateY(1px)}
.pair{transition:border-color .12s,transform .08s}
.pair .p-rom{font-size:12px;color:var(--grey)}
.pair.sel{border-color:var(--blue);background:var(--sel-bg,#E6EDF3);color:var(--blue-d)}
.pair.wrong{border-color:var(--red);background:var(--red-l);animation:shake .3s}
@keyframes shake{25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}

/* ---------- footer / feedback ---------- */
.foot{
  position:fixed;left:0;right:0;bottom:0;border-top:1px solid var(--wing);
  background:var(--sheet);padding:14px 18px calc(18px + env(safe-area-inset-bottom));
}
/* The verdict arrives rather than appearing, which is the difference
   between an answer being marked and a page simply changing colour. */
.foot.ok,.foot.bad{animation:verdict .18s ease-out both}
@keyframes verdict{from{transform:translateY(14px)}to{transform:none}}
.foot-in{max-width:700px;margin:0 auto;display:flex;align-items:center;gap:16px}
.foot-in .btn{max-width:220px;margin-left:auto}
.foot.ok{background:var(--green-l);border-top-color:var(--green)}
.foot.bad{background:var(--red-l);border-top-color:var(--red)}
.verdict{flex:1;display:flex;align-items:center;gap:12px}
.verdict .v-ic{width:42px;height:42px;border-radius:var(--radius);background:var(--sheet);
  display:grid;place-items:center;font-size:22px}
.verdict h3{margin:0;font-size:19px;font-weight:700}
.verdict p{margin:2px 0 0;font-size:14px;font-weight:600}
.foot.ok .verdict{color:var(--green-t)} .foot.bad .verdict{color:var(--red-t)}
@media (max-width:560px){
  .foot-in{flex-direction:column;align-items:stretch}
  .foot-in .btn{max-width:none;margin-left:0}
  .verdict{margin-bottom:10px}
}

/* ---------- finish screen ---------- */
.finish{flex:1;display:grid;place-items:center;text-align:center;padding:30px 18px 160px}
/* The lesson is stamped rather than trophied */
.stamp{
  width:92px;height:92px;margin:0 auto;display:grid;place-items:center;
  border:3px solid var(--red);border-radius:var(--radius);
  color:var(--red);font-size:34px;font-weight:600;line-height:1.3;
  animation:stampdown .45s cubic-bezier(.2,1.4,.5,1);
}
.stamp.clean{background:var(--red);color:var(--sheet)}
@keyframes stampdown{0%{transform:scale(1.6) rotate(-8deg);opacity:0}100%{transform:none;opacity:1}}
.finish h1{font-size:28px;font-weight:600;color:var(--ink);margin:16px 0 24px}
.cards{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}
.card{border:1px solid var(--grey-l);border-top:3px solid var(--yellow);
  border-radius:var(--radius);min-width:112px;background:var(--sheet)}
.card h4{margin:0;padding:8px 6px 0;font-size:10px;color:var(--grey);
  text-transform:uppercase;letter-spacing:.12em;font-weight:600}
.card div{padding:4px 9px 10px;font-size:20px;font-weight:700;color:var(--ink)}
.card.blue{border-top-color:var(--blue)}
.card.red{border-top-color:var(--red)}

.empty{padding:40px 18px;text-align:center;color:var(--grey)}
.hint{font-size:13px;color:var(--grey);font-weight:600;text-align:center;margin-top:18px}
.kbd{font-size:11px;color:var(--grey);text-align:center;margin-top:10px}

/* ---------- account / sync ---------- */
.auth{display:flex;align-items:center;gap:8px}
.auth .signin{
  font-size:12px;text-transform:uppercase;letter-spacing:.1em;color:var(--ink);
  border:1px solid var(--grey-l);border-radius:var(--radius);padding:6px 12px;
}
.auth .signin:hover{border-color:var(--red);color:var(--red)}
.auth .who{display:flex;align-items:center;gap:7px;font-size:14px;color:var(--ink)}
.auth .who img{width:26px;height:26px;border-radius:var(--radius);display:block}
.auth .dot{width:7px;height:7px;border-radius:var(--radius);background:transparent;flex:none}
.auth .dot.syncing{background:var(--blue);animation:pulse 1s ease-in-out infinite}
.auth .dot.saved{background:var(--green)}
.auth .dot.error{background:var(--yellow)}
@keyframes pulse{0%,100%{opacity:.3}50%{opacity:1}}

.home-link{
  font-size:12px;text-transform:uppercase;letter-spacing:.1em;color:var(--grey);
  text-decoration:none;white-space:nowrap;
}
.home-link:hover{color:var(--red)}

@media (max-width:560px){
  /* The lesson bar is four things across a phone, so the switch drops its
     example and stands as the box alone, with the title to explain it. */
  .lesson-top{gap:10px;padding:12px 12px}
  .btn-toggle.compact .toggle-eg{display:none}
  .btn-toggle.compact{padding:5px 7px}

  /* A sheet with 18px of paper either side of it wastes the only dimension a
     phone is short of, so it runs to the edges and keeps only its rules. */
  .stage{padding-left:0;padding-right:0}
  .exercise{border-left:0;border-right:0;padding:20px 16px 24px}

  /* Six items will not fit across a phone, so the spacer becomes a line
     break and the account controls take a second row. */
  .top{padding:10px 12px}
  .top-in{gap:8px 14px;flex-wrap:wrap}
  .top-in .spacer{flex:0 0 100%;height:0}
  /* The labels used to be dropped here, which left "0   0 / 43" standing on
     its own meaning nothing. They stack under the number instead, which is
     narrow enough to fit and still says what is being counted. */
  .stat{align-items:flex-start}
  .stat-val{font-size:14px}
  .stat-label{font-size:9px;letter-spacing:.08em}
  .node-row{grid-template-columns:44px 38px 1fr;gap:0 14px}
  .node{width:38px;height:38px;font-size:16px}
}

/* ---------- the cheering elephant ----------
   The same figure that stands on the landing page, posed with his trunk up
   and dropped on the finish screen above the stamp. The classes below
   repeat shared/site.css rather than importing it: the lesson page does not
   load that stylesheet, and pulling the whole landing sheet in for one
   drawing would be a heavier thing than copying five rules.

   What moves: the hop, the curl at the trunk's tip, the ear, and four gold
   sparks that rise and fade on a stagger. He arrives from below with the
   stamp, so the two read as one beat rather than two. */
.cheer{
  display:block;width:104px;height:156px;margin:0 auto 2px;
  animation:cheer-in .5s cubic-bezier(.2,1.3,.5,1) both;
}
.cheer svg{display:block;width:100%;height:100%;overflow:visible}
.cheer .art {fill:none;stroke:var(--figure-ink,#2f2619);stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
.cheer .orn {fill:none;stroke:var(--figure-gold,#a87c12);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.cheer .fine{stroke-width:.95;opacity:.8}
.cheer .shade{fill:var(--figure-shade,#000);opacity:var(--figure-shade-o,.1);stroke:none}
.cheer .dot {fill:var(--figure-ink,#2f2619);stroke:none}
.cheer .spark{fill:#c9a227;stroke:none;opacity:0;animation:cheer-spark 1.9s ease-out infinite;animation-delay:var(--d)}

.cheer .hop,
.cheer .curl,
.cheer .flap{transform-box:fill-box}
/* Higher and quicker than the breathing on the landing page: this one is
   pleased with itself, not idling. */
.cheer .hop {transform-origin:50% 100%;animation:cheer-hop .9s ease-in-out infinite}
.cheer .curl{transform-origin:70% 90%;animation:cheer-curl 1.1s ease-in-out infinite}
.cheer .flap{transform-origin:8% 30%;animation:oc-flap 1s ease-in-out infinite}

@keyframes cheer-in   {0%{transform:translateY(14px) scale(.9);opacity:0}100%{transform:none;opacity:1}}
@keyframes cheer-hop  {0%,100%{transform:translateY(0)}45%{transform:translateY(-7px)}}
@keyframes cheer-curl {0%,100%{transform:rotate(-7deg)}50%{transform:rotate(7deg)}}
@keyframes oc-flap    {0%,100%{transform:rotate(-6deg)}50%{transform:rotate(6deg)}}
@keyframes cheer-spark{
  0%  {opacity:0;transform:translateY(6px) scale(.6)}
  25% {opacity:1}
  100%{opacity:0;transform:translateY(-22px) scale(1.1)}
}

/* Stillness is a setting, not a preference to talk somebody out of. */
@media (prefers-reduced-motion: reduce){
  .foot.ok,.foot.bad,.arr-place{animation:none}
  .cheer,
  .cheer .hop,
  .cheer .curl,
  .cheer .flap,
  .cheer .spark{animation:none}
  .cheer .spark{opacity:.85}
}


/* The figures on the finish screen take the same ink as the ones on the
   landing page, for the same reason: a line drawing in dark ink on a dark
   wall is not a drawing. */
/* Written twice; see shared/theme.css for why. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --figure-ink:#D7DCD6;
    /* The map's sheet: lighter than the wall, still night. And the road
       not yet walked, which was a pale stone dash made to sit on cream. */
    --sheet-tint:#161C19; --road-ahead:#4A554D; --seal-ink:#F3F6F0; --figure-gold:#DFB551;
    --figure-shade:#fff; --figure-shade-o:.06;
  }
}

  :root[data-theme="dark"]{
    --figure-ink:#D7DCD6;
    /* The map's sheet: lighter than the wall, still night. And the road
       not yet walked, which was a pale stone dash made to sit on cream. */
    --sheet-tint:#161C19; --road-ahead:#4A554D; --seal-ink:#F3F6F0; --figure-gold:#DFB551;
    --figure-shade:#fff; --figure-shade-o:.06;
  }


/* A unit's colour was picked to be read on cream. Four of the ten — the
   indigo, the teal, the purple, the green — go muddy as ink on a dark
   sheet, so where the colour is a letter rather than a block it is mixed
   with white until it reads. The blocks it fills are left alone: a
   saturated square is exactly as loud as it should be at night. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .place-en,
  :root:not([data-theme="light"]) .stop.walked .stop-dot{
    color:color-mix(in srgb, var(--unit, var(--red)) 62%, #ffffff);
  }
}
:root[data-theme="dark"] .place-en,
:root[data-theme="dark"] .stop.walked .stop-dot{
  color:color-mix(in srgb, var(--unit, var(--red)) 62%, #ffffff);
}
