/* lesson.css — Tony's Table, Lesson 1. Everything is scoped under .lsn so the
   component can live inside the deck without touching the deck's styles.
   Tokens: deck tokens from css/deck.css when present, the same values as fallbacks
   when the lesson runs standalone. Only the Duolingo app tints that the deck's
   token table doesn't carry are defined here. */

.lsn {
  --l-ink: var(--ink, #3C3C3C);
  --l-ink-2: var(--ink-2, #777777);
  --l-line: var(--line, #E5E5E5);
  --l-paper: var(--paper, #FFFFFF);
  --l-green: var(--green, #58CC02);
  --l-green-dk: var(--green-dk, #58A700);
  --l-blue: var(--blue, #1CB0F6);
  --l-gold: var(--gold, #FFC800);
  --l-orange: var(--orange, #FF9600);
  --l-red: var(--red, #FF4B4B);
  --l-purple: var(--purple, #CE82FF);
  --l-felt: var(--felt, #1E6B4A);
  --l-felt-dk: var(--felt-dk, #14503A);
  --l-vest: var(--vest, #CF2A36);
  /* Duolingo app tints (not in the deck token table) */
  --l-muted: #AFAFAF;
  --l-hover: #F7F7F7;
  --l-green-bg: #D7FFB8;
  --l-green-line: #A5ED6E;
  --l-green-tint: #F1FFE4;
  --l-red-bg: #FFDFE0;
  --l-red-dk: #EA2B2B;
  --l-red-line: #FFB2B2;
  --l-red-tint: #FFF1F1;
  --l-blue-bg: #DDF4FF;
  --l-blue-line: #84D8FF;
  --l-blue-dk: #1899D6;
  --l-gold-dk: #E5A800;
  --l-gold-tx: #D49B00;
  --l-orange-dk: #E08600;
  --l-purple-dk: #B066E0;
  --l-card-red: #E5383B;
  --l-card-black: #2B2B33;
  --l-navy: #2F3E70;
  --l-navy-2: #4A5D9C;
  --l-felt-shadow: #165A3E;

  --status-h: 0px;
  --top-h: 52px;
  --home-top: 52px;
  --home-h: 360px;
  --foot-pad-b: 14px;

  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--l-paper);
  color: var(--l-ink);
  font-family: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  isolation: isolate;
  text-align: left;
  line-height: 1.25;
  letter-spacing: 0;
}
:where(.lsn) *, :where(.lsn) *::before, :where(.lsn) *::after { box-sizing: border-box; }
.lsn[data-mode="pitch"] { pointer-events: none; }
:where(.lsn) button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  text-align: inherit; letter-spacing: inherit;
}
:where(.lsn) button:focus { outline: none; }
:where(.lsn) button:focus-visible { outline: none; }
:where(.lsn) .lsn-x:focus-visible, :where(.lsn) .lsn-ladder-btn:focus-visible { outline: 3px solid var(--l-blue-line); outline-offset: 1px; }
:where(.lsn) h1, :where(.lsn) h2, :where(.lsn) p { margin: 0; }
:where(.lsn) svg { display: block; }

/* ------------------------------------------------------------------ device chrome (pitch) */

.lsn-status {
  position: absolute; left: 0; right: 0; top: 0; height: var(--status-h); z-index: 7;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 26px 0 34px; font-weight: 800; font-size: 15px; color: var(--l-ink);
  background: var(--l-paper);
}
.lsn-status-icons { display: flex; align-items: center; gap: 6px; }
.lsn-homebar {
  position: absolute; left: 50%; bottom: 8px; width: 134px; height: 5px; margin-left: -67px;
  border-radius: 9px; background: var(--l-ink); z-index: 9; pointer-events: none;
}

/* ------------------------------------------------------------------ top bar */

.lsn-top {
  position: absolute; left: 0; right: 0; top: var(--status-h); height: var(--top-h); z-index: 6;
  display: flex; align-items: center; gap: 12px; padding: 0 16px 0 12px; background: transparent;
}
.lsn-x {
  position: relative; flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 12px; color: var(--l-muted);
}
.lsn-x svg { position: absolute; width: 18px; height: 18px; }
.lsn-x .lsn-ico-back { width: 14px; height: 22px; }
.lsn-prog {
  position: relative; flex: 1; height: 16px; border-radius: 99px; background: var(--l-line); overflow: hidden;
  transform-origin: 0 50%;
}
.lsn-prog-fill {
  position: absolute; inset: 0; border-radius: 99px; background: var(--l-green);
}
.lsn-prog-fill::after {
  content: ''; position: absolute; left: 10px; right: 10px; top: 4px; height: 4px; border-radius: 99px;
  background: rgba(255, 255, 255, .3);
}
.lsn-prog-glint {
  position: absolute; top: 0; bottom: 0; left: 0; width: 40px; border-radius: 99px;
  background: rgba(255, 255, 255, .55); opacity: 0;
}
.lsn-ladder-btn {
  position: relative; flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px;
}
.lsn-ladder-btn svg { width: 24px; height: 28px; }
.lsn-ladder-ring {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 3px solid var(--l-gold); opacity: 0; pointer-events: none;
}
.lsn-hearts {
  position: relative; flex: none; display: flex; align-items: center; gap: 6px; min-width: 44px;
  color: var(--l-red); font-weight: 800; font-size: 17px;
}
.lsn-heart { position: relative; width: 26px; height: 24px; }
.lsn-heart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lsn-heart-half { opacity: 0; }
.lsn-hearts-n { position: relative; display: inline-block; min-width: 10px; height: 22px; line-height: 22px; overflow: visible; }
.lsn-hearts-n span { position: absolute; left: 0; top: 0; }
.lsn-hearts.is-empty { color: var(--l-muted); }
.lsn-hearts.is-empty .lsn-heart-whole { fill: var(--l-line); }
.lsn[data-phase="onboard"] .lsn-hearts,
.lsn[data-phase="onboard"] .lsn-prog { visibility: hidden; }

/* ------------------------------------------------------------------ home base (Tony behind his table) */

/* v2.2 headroom: the home base clips its sides and bottom, but not its top, which opens into the top bar's row (the
   bar's white is the root's, not its own), so what Tony raises above his head (the streak's tossed chips, the
   flick's chip in his fingertips) overflows cleanly into that white instead of being cut flat at the bar's edge. */
.lsn-home {
  position: absolute; left: 0; top: var(--home-top); width: 100%; height: var(--home-h);
  overflow: visible; clip-path: inset(calc(-1 * var(--top-h)) 0 0 0); z-index: 1; background: var(--l-paper);
}
.lsn-cam { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 50% 30%; }
.lsn-scene { position: absolute; left: 0; top: 0; width: 375px; height: 360px; transform-origin: 0 0; }
.lsn-layer { position: absolute; left: 0; top: 0; width: 375px; height: 360px; display: block; pointer-events: none; -webkit-user-drag: none; }
.lsn-tony { position: absolute; pointer-events: none; }
.lsn-tony > svg { width: 100%; height: 100%; }
.lsn-tony-fallback { position: absolute; max-width: none; pointer-events: none; }
.lsn-felt { position: absolute; left: 0; top: 0; width: 375px; height: 360px; }
.lsn-fcard { position: absolute; padding: 0; border-radius: 7px; }
.lsn-fcard-shadow {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0; border-radius: 7px; background: var(--l-felt-shadow);
  transform: translateY(5px); opacity: 0;
}
.lsn-fcard-body { position: absolute; left: 0; top: 0; }
.lsn-fcard .card-front { transition: border-color calc(140ms / var(--lsn-k, 1)), background-color calc(140ms / var(--lsn-k, 1)); }
.lsn-fcard.is-selected .card-front { border-color: var(--l-blue) !important; border-bottom-color: var(--l-blue-dk) !important; background: #EEF9FF; }
.lsn-fcard.is-right .card-front { border-color: var(--l-green) !important; border-bottom-color: var(--l-green-dk) !important; background: var(--l-green-tint); }
.lsn-fcard.is-wrong .card-front { border-color: var(--l-red) !important; border-bottom-color: var(--l-red-dk) !important; background: var(--l-red-tint); }
.lsn-fcard.is-press .lsn-fcard-body { translate: 0 2px; scale: .96; }
.lsn-felt-label {
  position: absolute; left: 0; top: 0; padding: 0 11px; height: 24px; line-height: 24px; border-radius: 99px;
  font-size: 15px; font-weight: 900; letter-spacing: .2px; color: #fff; white-space: nowrap;
  background: var(--l-ink-2); box-shadow: 0 2px 0 rgba(0, 0, 0, .18); transform-origin: 50% 100%;
}
.lsn-felt-label.is-good { background: var(--l-green); box-shadow: 0 2px 0 var(--l-green-dk); }
.lsn-felt-label.is-bad { background: var(--l-red); box-shadow: 0 2px 0 var(--l-red-dk); }
.lsn-pot { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.lsn-pot-shadow { position: absolute; border-radius: 50%; background: #175D40; }
.lsn-chip { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.lsn-chip svg { width: 100%; height: 100%; overflow: visible; }

/* ------------------------------------------------------------------ content panel */

.lsn-panel {
  position: absolute; left: 0; right: 0; top: var(--home-top); height: calc(100% - var(--home-top));
  z-index: 2; background: var(--l-paper); border-radius: 22px 22px 0 0;
  /* the scene behind is white too, so a hairline (it follows the corners) marks the sheet's edge */
  box-shadow: 0 -2px 0 var(--l-line);
}
.lsn-body {
  position: absolute; left: 0; right: 0; top: 0; overflow-x: hidden; overflow-y: auto;
  scrollbar-width: none; overscroll-behavior: contain;
}
.lsn-body::-webkit-scrollbar { display: none; }
.lsn[data-mode="pitch"] .lsn-body { overflow-y: hidden; }
.lsn-screen { position: relative; padding: 18px 16px 12px; }
.lsn-screen.is-leaving { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }

.lsn-title { font-weight: 800; font-size: 22px; line-height: 1.22; letter-spacing: -.1px; color: var(--l-ink); }
.lsn-qhead { margin-bottom: 14px; }
.lsn-mistake {
  display: flex; align-items: center; gap: 6px; color: var(--l-orange); margin-bottom: 6px;
  font-weight: 900; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase;
}
.lsn-mistake svg { width: 18px; height: 18px; }

/* dialog bubble: Tony's lines, tail pointing up at him */
.lsn-bubble {
  position: relative; background: var(--l-paper); border: 2px solid var(--l-line); border-radius: 16px;
  padding: 11px 16px 12px; font-size: 17px; line-height: 1.36; font-weight: 700; color: var(--l-ink);
  transform-origin: 50% 0;
}
.lsn-bubble::before, .lsn-bubble::after {
  content: ''; position: absolute; left: var(--tail-x, 50%); width: 0; height: 0; border-style: solid;
}
.lsn-bubble::before { top: -13px; margin-left: -11px; border-width: 0 11px 13px 11px; border-color: transparent transparent var(--l-line) transparent; }
.lsn-bubble::after { top: -9.5px; margin-left: -9px; border-width: 0 9px 11px 9px; border-color: transparent transparent var(--l-paper) transparent; }
.lsn-bubble-text { display: block; }
.lsn-bubble.is-empty { visibility: hidden; }

/* ------------------------------------------------------------------ buttons */

.lsn-btn {
  --b: var(--l-green); --b-sh: var(--l-green-dk); --b-tx: #fff;
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%;
  height: 50px; border-radius: 16px; border: 2px solid var(--b); background: var(--b); color: var(--b-tx);
  box-shadow: 0 4px 0 var(--b-sh);
  font-weight: 800; font-size: 15px; letter-spacing: .8px; text-transform: uppercase;
}
.lsn-btn--red { --b: var(--l-red); --b-sh: var(--l-red-dk); }
.lsn-btn--blue { --b: var(--l-blue); --b-sh: var(--l-blue-dk); }
.lsn-btn--ghost { --b: transparent; --b-sh: transparent; --b-tx: var(--l-blue); box-shadow: none; }
/* press: straight down onto the lip; release: springs back up with a little overshoot */
.lsn-btn { transition: translate calc(.28s / var(--lsn-k, 1)) cubic-bezier(.3, 1.9, .5, 1), box-shadow calc(.28s / var(--lsn-k, 1)) cubic-bezier(.3, 1.9, .5, 1); }
.lsn-btn:active:not(:disabled), .lsn-btn.is-press { translate: 0 4px; box-shadow: 0 0 0 var(--b-sh); transition-duration: 0s; }
.lsn-btn:disabled { --b: var(--l-line); --b-tx: var(--l-muted); --b-sh: transparent; box-shadow: none; cursor: default; }
.lsn-btn-label { display: block; }

/* ------------------------------------------------------------------ footer + feedback */

.lsn-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; }
.lsn-foot-line { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--l-line); }
/* the bar's own white is only ever as tall as the resting bar: the feedback sheet brings its own colour as it
   slides up, so the footer growing for the copy never blanks out the options above it */
.lsn-foot-bg { position: absolute; left: 0; right: 0; bottom: 0; height: calc(64px + var(--foot-pad-b)); background: var(--l-paper); }
.lsn-fb-sheet { position: absolute; left: 0; right: 0; top: 0; bottom: -40px; background: var(--l-green-bg); }
.lsn-foot[data-state="wrong"] .lsn-fb-sheet { background: var(--l-red-bg); }
.lsn-foot-inner { position: relative; padding: 14px 16px var(--foot-pad-b); }
.lsn-fb { display: none; padding: 2px 0 14px; }
.lsn-foot[data-state="correct"] .lsn-fb, .lsn-foot[data-state="wrong"] .lsn-fb { display: block; }
.lsn-fb-streak {
  display: none; align-items: center; gap: 5px; height: 26px; margin: 0 0 8px 46px; padding: 0 11px 0 8px;
  border-radius: 99px; background: var(--l-orange); color: #fff; box-shadow: 0 3px 0 var(--l-orange-dk);
  font-weight: 900; font-size: 13px; letter-spacing: .9px; text-transform: uppercase; width: max-content;
  transform-origin: 30% 60%;
}
.lsn-fb-streak.is-on { display: flex; }
.lsn-fb-streak svg { width: 15px; height: 17px; transform-origin: 50% 90%; animation: lsn-flicker 520ms ease-in-out infinite alternate; }
@keyframes lsn-flicker { 0% { transform: scale(1, 1) skewX(0deg); } 50% { transform: scale(.94, 1.1) skewX(-4deg); } 100% { transform: scale(1.04, .95) skewX(3deg); } }
.lsn-fb-main { display: flex; align-items: flex-start; gap: 12px; }
.lsn-fb-icon {
  flex: none; position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--l-paper);
  display: grid; place-items: center; color: var(--l-green);
}
.lsn-fb-icon svg { position: absolute; width: 20px; height: 20px; }
.lsn-foot[data-state="wrong"] .lsn-fb-icon { color: var(--l-red); }
.lsn-fb-icon .lsn-ico-x { display: none; }
.lsn-foot[data-state="wrong"] .lsn-fb-icon .lsn-ico-check { display: none; }
.lsn-foot[data-state="wrong"] .lsn-fb-icon .lsn-ico-x { display: block; }
.lsn-fb-copy { flex: 1; min-width: 0; padding-top: 3px; }
.lsn-fb-title { font-weight: 900; font-size: 21px; line-height: 1.24; color: var(--l-green-dk); }
.lsn-foot[data-state="wrong"] .lsn-fb-title { color: var(--l-red-dk); }
.lsn-fb-line { font-weight: 700; font-size: 16px; line-height: 1.36; color: var(--l-red-dk); margin-top: 5px; }
.lsn-fb-line:empty { display: none; }
.lsn-cchip {
  display: inline-flex; align-items: center; gap: 1px; height: 24px; padding: 0 6px 1px; margin: 0 3px 0 0;
  vertical-align: -3px; background: #fff; border-radius: 7px; border: 2px solid rgba(0, 0, 0, .08); border-bottom-width: 3px;
  color: var(--l-card-black); font-weight: 900; font-size: 15px; line-height: 1;
}
.lsn-cchip.is-red { color: var(--l-card-red); }
.lsn-cchip svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ option tiles */

.lsn-opts { display: grid; gap: 10px; }
.lsn-opts--2 { grid-template-columns: 1fr 1fr; }
.lsn-opt {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px;
  padding: 9px 16px; border-radius: 14px; background: var(--l-paper);
  border: 2px solid var(--l-line); box-shadow: 0 2px 0 var(--l-line);
  font-weight: 700; font-size: 17px; color: var(--l-ink);
  transition: background-color calc(120ms / var(--lsn-k, 1)), border-color calc(120ms / var(--lsn-k, 1)), color calc(120ms / var(--lsn-k, 1)), box-shadow calc(120ms / var(--lsn-k, 1));
}
.lsn-opts--2 .lsn-opt { justify-content: center; text-align: center; }
.lsn-opt-label { flex: 1; }
.lsn-opts--2 .lsn-opt-label { flex: none; }
.lsn-opt.is-press, .lsn[data-mode="free"] .lsn-opt:active:not(.is-off) { translate: 0 2px; box-shadow: 0 0 0 var(--l-line); }
.lsn-opt.is-selected { background: var(--l-blue-bg); border-color: var(--l-blue-line); box-shadow: 0 2px 0 var(--l-blue-line); color: var(--l-blue-dk); }
.lsn-opt.is-selected.is-press { box-shadow: 0 0 0 var(--l-blue-line); }
.lsn-opt.is-right { background: var(--l-green-tint); border-color: var(--l-green-line); box-shadow: 0 2px 0 var(--l-green-line); color: var(--l-green-dk); }
.lsn-opt.is-wrong { background: var(--l-red-tint); border-color: var(--l-red-line); box-shadow: 0 2px 0 var(--l-red-line); color: var(--l-red-dk); }
.lsn-opt.is-off { color: var(--l-muted); }
.lsn-opt.is-off .lsn-opt-icon { opacity: .4; filter: grayscale(1); }
.lsn-opt-icon { flex: none; width: 40px; height: 32px; display: grid; place-items: center; }
.lsn-opt-icon svg { width: 40px; height: 32px; }
.lsn-soon {
  flex: none; padding: 0 8px; height: 20px; line-height: 20px; border-radius: 6px; background: var(--l-line);
  color: var(--l-ink-2); font-weight: 900; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
}

/* hand tiles: an option tile holding a felt strip of five cards. v2: the cards fill the strip (they are
   what the room has to read from the back), sized from the tiles' width, capped by the height three
   tiles may take above the CHECK bar. */
.lsn-picks { display: grid; gap: 12px; container-type: inline-size; }
.lsn-htile {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 6px 5px 7px; border-radius: 14px; background: var(--l-paper);
  border: 2px solid var(--l-line); box-shadow: 0 2px 0 var(--l-line);
  transition: background-color calc(120ms / var(--lsn-k, 1)), border-color calc(120ms / var(--lsn-k, 1)), box-shadow calc(120ms / var(--lsn-k, 1));
}
.lsn-htile.is-press, .lsn[data-mode="free"] .lsn-htile:active { translate: 0 2px; box-shadow: 0 0 0 var(--l-line); }
.lsn-htile.is-selected { background: var(--l-blue-bg); border-color: var(--l-blue-line); box-shadow: 0 2px 0 var(--l-blue-line); }
.lsn-htile.is-right { background: var(--l-green-tint); border-color: var(--l-green-line); box-shadow: 0 2px 0 var(--l-green-line); }
.lsn-htile.is-wrong { background: var(--l-red-tint); border-color: var(--l-red-line); box-shadow: 0 2px 0 var(--l-red-line); }
.lsn-htile .card { --cw: min(51px, calc((100cqw - 75px) / 5)); }
.lsn-hletter {
  flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--l-line);
  display: grid; place-items: center; font-weight: 900; font-size: 14px; color: var(--l-muted);
  transition: border-color calc(120ms / var(--lsn-k, 1)), color calc(120ms / var(--lsn-k, 1));
}
.lsn-htile.is-selected .lsn-hletter { border-color: var(--l-blue-line); color: var(--l-blue); }
.lsn-htile.is-right .lsn-hletter { border-color: var(--l-green-line); color: var(--l-green); }
.lsn-htile.is-wrong .lsn-hletter { border-color: var(--l-red-line); color: var(--l-red); }
.lsn-hfelt {
  flex: 1; display: flex; justify-content: space-between; gap: 3px; padding: 4px 5px 5px; border-radius: 10px;
  background: var(--l-felt); box-shadow: 0 3px 0 var(--l-felt-dk);
}
.lsn-tag {
  position: absolute; top: -14px; right: 10px; z-index: 3; padding: 0 12px; height: 27px; line-height: 27px;
  border-radius: 99px; white-space: nowrap; background: var(--l-ink-2); color: #fff;
  font-weight: 900; font-size: 17px; letter-spacing: .1px; box-shadow: 0 2px 0 rgba(0, 0, 0, .14);
  opacity: 0; transform-origin: 50% 100%;
}
.lsn-tag.is-good { background: var(--l-green); box-shadow: 0 2px 0 var(--l-green-dk); }
.lsn-tag.is-bad { background: var(--l-red); box-shadow: 0 2px 0 var(--l-red-dk); }

/* match (Q1) */
.lsn-match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.lsn-mtile {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 62px; width: 100%;
  border-radius: 14px; background: var(--l-paper); border: 2px solid var(--l-line); box-shadow: 0 2px 0 var(--l-line);
  font-weight: 700; font-size: 17px; color: var(--l-ink); padding: 5px 8px;
  transition: background-color calc(120ms / var(--lsn-k, 1)), border-color calc(120ms / var(--lsn-k, 1)), box-shadow calc(120ms / var(--lsn-k, 1)), color calc(120ms / var(--lsn-k, 1));
}
.lsn-mtile.is-press, .lsn[data-mode="free"] .lsn-mtile:active:not(.is-done) { translate: 0 2px; box-shadow: 0 0 0 var(--l-line); }
.lsn-mtile.is-selected { background: var(--l-blue-bg); border-color: var(--l-blue-line); box-shadow: 0 2px 0 var(--l-blue-line); color: var(--l-blue-dk); }
.lsn-mtile.is-match { background: var(--l-green-tint); border-color: var(--l-green-line); box-shadow: 0 2px 0 var(--l-green-line); color: var(--l-green-dk); }
.lsn-mtile.is-miss { background: var(--l-red-tint); border-color: var(--l-red-line); box-shadow: 0 2px 0 var(--l-red-line); color: var(--l-red-dk); }
.lsn-mtile.is-done { border-color: var(--l-line); box-shadow: 0 2px 0 var(--l-line); color: var(--l-line); background: var(--l-paper); pointer-events: none; }
.lsn-mtile.is-done .card { opacity: .3; }
.lsn-mtile .card { --cw: 36px; }

/* seats (Q10): "who wins?" is asked of the room, so the three hands are as big as the row allows: the
   cards overlap a little like a hand held at the table, the pile keeps its spot at the right end */
.lsn-seats { display: grid; gap: 12px; }
.lsn-seat {
  position: relative; display: flex; align-items: center; gap: 6px; width: 100%; min-height: 70px;
  padding: 6px 6px 6px 6px; border-radius: 16px; background: var(--l-paper);
  border: 2px solid var(--l-line); box-shadow: 0 2px 0 var(--l-line);
  transition: background-color calc(120ms / var(--lsn-k, 1)), border-color calc(120ms / var(--lsn-k, 1)), box-shadow calc(120ms / var(--lsn-k, 1));
}
.lsn-seat.is-press, .lsn[data-mode="free"] .lsn-seat:active { translate: 0 2px; box-shadow: 0 0 0 var(--l-line); }
.lsn-seat.is-selected { background: var(--l-blue-bg); border-color: var(--l-blue-line); box-shadow: 0 2px 0 var(--l-blue-line); }
.lsn-seat.is-right { background: var(--l-green-tint); border-color: var(--l-green-line); box-shadow: 0 2px 0 var(--l-green-line); }
.lsn-seat.is-wrong { background: var(--l-red-tint); border-color: var(--l-red-line); box-shadow: 0 2px 0 var(--l-red-line); }
.lsn-seat-who { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.lsn-avatar {
  position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  background: var(--av, var(--l-purple)); display: grid; place-items: center;
}
.lsn-avatar > svg, .lsn-avatar > div { width: 100%; height: 100%; }
.lsn-avatar-initial { color: #fff; font-weight: 900; font-size: 19px; line-height: 1; }
.lsn-seat-name { font-weight: 900; font-size: 14px; color: var(--l-ink); line-height: 1.15; }
.lsn-seat.is-selected .lsn-seat-name { color: var(--l-blue-dk); }
.lsn .lsn-seat .lsn-hand { flex: none; gap: 0; }
.lsn-seats { container-type: inline-size; }
.lsn-seat .card { --cw: min(52px, calc((100cqw - 126px) / 4.4)); }
.lsn .lsn-seat .lsn-hand .card + .card { margin-left: calc(var(--cw) * -.15); }
/* the pile fills the tile's right end; the tag sits on the tile's top edge, like the hand tiles' */
.lsn-seat-pile { position: relative; flex: 1; min-width: 50px; align-self: stretch; margin-top: 6px; }

/* ------------------------------------------------------------------ cards (vendor/cards.js markup), scoped */

:where(.lsn) .card { --cw: 40px; }
.lsn .card {
  position: relative; flex: none; width: var(--cw); height: calc(var(--cw) * 1.4);
  font-size: var(--cw); perspective: calc(var(--cw) * 8); margin: 0; padding: 0; border: 0; background: none;
  box-shadow: none; transition: none; transform: none;
}
.lsn .card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: none; }
.lsn .card.is-down .card-inner { transform: rotateY(180deg); }
.lsn .card-front, .lsn .card-back {
  position: absolute; inset: 0; border-radius: .13em;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.lsn .card-front {
  background: #fff; border: 2px solid #E2E2E2; border-bottom-width: 4px;
  color: var(--l-card-black); overflow: hidden;
}
.lsn .card--red .card-front { color: var(--l-card-red); }
.lsn .card-back { transform: rotateY(180deg); background: var(--l-navy); border: 2px solid #26335E; border-bottom-width: 4px; }
.lsn .card-back::after { content: ''; position: absolute; inset: .07em; border-radius: .07em; background: var(--l-navy-2); }
.lsn .card-idx { position: absolute; left: .06em; top: .05em; width: .27em; display: flex; flex-direction: column; align-items: center; }
.lsn .card-idx--flip { left: auto; top: auto; right: .06em; bottom: .03em; transform: rotate(180deg); }
.lsn .card-rank { font-weight: 900; font-size: .3em; line-height: 1; letter-spacing: -.02em; }
.lsn .card-rank.is-ten { letter-spacing: -.1em; font-size: .27em; margin-left: -.08em; }
.lsn .card-suit { width: .17em; height: .17em; margin-top: .02em; }
.lsn .card-pip { position: absolute; left: 50%; top: 50%; width: .44em; height: .44em; transform: translate(-50%, -48%); }
.lsn .card--sm .card-front, .lsn .card--sm .card-back { border-bottom-width: 3px; }
/* tiny cards (ladder rows): rank + suit only */
.lsn .card--xs .card-front, .lsn .card--xs .card-back { border-width: 1.5px; border-bottom-width: 2.5px; border-radius: 4px; }
.lsn .card--xs .card-back::after { inset: 2px; border-radius: 2px; }
.lsn .card--xs .card-pip, .lsn .card--xs .card-idx--flip { display: none; }
.lsn .card--xs .card-idx { left: 0; right: 0; top: 2px; width: auto; }
.lsn .card--xs .card-rank { font-size: .48em; }
.lsn .card--xs .card-rank.is-ten { font-size: .42em; margin-left: -.05em; }
.lsn .card--xs .card-suit { width: .42em; height: .42em; margin-top: 1px; }
.lsn .hand, .lsn .lsn-hand { display: flex; gap: 4px; align-items: flex-end; }

/* ------------------------------------------------------------------ the ladder (T2 + sheet) */

.lsn-ladder {
  position: relative; border-radius: 18px; background: var(--l-felt); box-shadow: 0 4px 0 var(--l-felt-dk);
  padding: 6px 10px 8px; color: #fff; transform-origin: 50% 50%;
}
.lsn-lrow {
  position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 9px;
  height: 33px; padding: 0 2px;
}
.lsn-lrow + .lsn-lrow::before { content: ''; position: absolute; left: 4px; right: 4px; top: -1px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .08); }
.lsn-lrow-n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: #fff; font-weight: 900; font-size: 12px;
}
.lsn-lrow-name { font-weight: 800; font-size: 15px; line-height: 1.1; color: #fff; white-space: nowrap; }
.lsn-lrow-line { display: none; font-weight: 700; font-size: 12.5px; line-height: 1.25; color: rgba(255, 255, 255, .72); margin-top: 2px; }
.lsn-lrow .lsn-hand { gap: 2px; }
.lsn-lrow .card { --cw: 21px; }
.lsn-lrow.is-top .lsn-lrow-n { background: var(--l-gold); color: var(--l-ink); }
.lsn-lrow.is-top .lsn-lrow-name { color: var(--l-gold); }
.lsn-lrow-shine { position: absolute; top: 2px; bottom: 2px; left: -20%; width: 30%; border-radius: 10px; background: rgba(255, 255, 255, .22); opacity: 0; pointer-events: none; }
.lsn-ladder--sheet .lsn-lrow { height: auto; padding: 8px 2px; align-items: center; }
.lsn-ladder--sheet .lsn-lrow-line { display: block; }
.lsn-ladder--sheet .lsn-lrow .card { --cw: 24px; }
.lsn-ladder-fly { position: absolute; z-index: 10; margin: 0; pointer-events: none; }

/* ------------------------------------------------------------------ end screens */

.lsn-screen[data-screen="complete"], .lsn-screen[data-screen="closed"] { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding-top: 8px; padding-bottom: 8px; }
.lsn-end-title { font-weight: 900; font-size: 32px; line-height: 1.15; text-align: center; color: var(--l-gold-tx); letter-spacing: -.3px; margin: 4px 0 18px; }
.lsn-end-title--dim { color: var(--l-ink); }
.lsn-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lsn-stat { border-radius: 16px; border: 2px solid var(--c); background: var(--c); padding-top: 3px; overflow: hidden; }
.lsn-stat-label { color: #fff; font-weight: 900; font-size: 12.5px; letter-spacing: .8px; text-transform: uppercase; text-align: center; padding: 2px 4px 5px; }
.lsn-stat-box {
  background: #fff; border-radius: 13px; height: 64px; display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--c); font-weight: 900; font-size: 24px;
}
.lsn-stat-box svg { width: 22px; height: 22px; flex: none; }
.lsn-stat--gold { --c: var(--l-gold); }
.lsn-stat--gold .lsn-stat-box { color: var(--l-gold-tx); }
.lsn-stat--green { --c: var(--l-green); }
.lsn-stat--blue { --c: var(--l-blue); }
.lsn-end-bubble-slot { margin-bottom: auto; padding-bottom: 12px; }
.lsn-screen[data-screen="complete"] { justify-content: flex-start; }
.lsn-screen[data-screen="closed"] { justify-content: flex-start; }
.lsn-screen[data-screen="closed"] > .lsn-bubble { margin-bottom: auto; }
.lsn-screen[data-screen="closed"] > .lsn-broken { margin-bottom: auto; }
.lsn-screen[data-screen="complete"] .lsn-stats { margin-bottom: auto; }
.lsn-broken { width: 64px; height: 60px; margin: 4px auto 0; }

/* ------------------------------------------------------------------ overlays */

.lsn-fx { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.lsn-touch {
  position: absolute; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: rgba(60, 60, 60, .2); border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 1px rgba(60, 60, 60, .12); opacity: 0;
}
.lsn-confetti { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }

.lsn-sheet-root { position: absolute; inset: 0; z-index: 9; display: flex; align-items: flex-end; }
.lsn-sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.lsn-sheet {
  position: relative; width: 100%; max-height: 90%; display: flex; flex-direction: column;
  background: var(--l-paper); border-radius: 22px 22px 0 0; padding-bottom: 12px;
}
.lsn-sheet-grab { width: 40px; height: 5px; border-radius: 9px; background: var(--l-line); margin: 10px auto 4px; flex: none; }
.lsn-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 10px 20px; }
.lsn-sheet-title { font-weight: 900; font-size: 21px; }
.lsn-sheet-body { overflow-y: auto; padding: 0 16px 8px; }
.lsn-sheet-copy { color: var(--l-ink-2); font-size: 17px; text-align: center; margin: 0 0 16px; }
.lsn-sheet-body .lsn-btn + .lsn-btn { margin-top: 10px; }

/* ------------------------------------------------------------------ v2: live play */

.lsn.is-noinput { pointer-events: none; }
.lsn-foot[data-state="correct"] .lsn-fb-line { color: var(--l-green-dk); }
/* a trackpad: tiles answer the pointer before the click */
@media (hover: hover) and (pointer: fine) {
  .lsn[data-mode="free"] .lsn-opt:not(.is-selected):not(.is-off):not(.is-right):not(.is-wrong):hover,
  .lsn[data-mode="free"] .lsn-htile:not(.is-selected):not(.is-right):not(.is-wrong):hover,
  .lsn[data-mode="free"] .lsn-mtile:not(.is-selected):not(.is-done):not(.is-match):not(.is-miss):hover,
  .lsn[data-mode="free"] .lsn-seat:not(.is-selected):not(.is-right):not(.is-wrong):hover { background: var(--l-hover); }
  .lsn[data-mode="free"] .lsn-btn:not(:disabled):hover { filter: brightness(1.04); }
  .lsn[data-mode="free"] button.lsn-fcard:hover .card-front { border-color: #CFCFCF; }
}
.lsn[data-mode="free"] button.lsn-fcard:active .lsn-fcard-body { translate: 0 2px; scale: .96; }

/* ------------------------------------------------------------------ v2.2: the ending, a full-screen cut (in the phone) */

.lsn-hand-chip { z-index: 3; }
/* the dive: the chip coming at you, then its flat face (crisp at any size) until its spade has the whole screen. Over
   everything in the app (top bar, panel, footer), under the phone's own status bar (7) and home bar (9). */
.lsn-dive { position: absolute; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; }
.lsn-dive-chip { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.lsn-dive-face { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; }
/* the streak screen: a screen of its own, white, built hidden and shown at the cut (.is-sx). Its footer (CONTINUE)
   comes up over it; Tony stands behind the footer, clipped at its top edge. */
.lsn-sx { position: absolute; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; background: var(--l-paper); visibility: hidden; }
.lsn.is-sx .lsn-sx { visibility: visible; }
.lsn.is-sx .lsn-foot { z-index: 7; }
.lsn.is-sx .lsn-foot-bg { height: 100%; }
.lsn.is-sx .lsn-foot-line { display: none; }
.lsn-sx-chip { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.lsn-sx-shadow { position: absolute; left: 0; top: 0; width: 180px; height: 18px; border-radius: 50%; background: var(--l-line); transform-origin: 50% 50%; }
.lsn-sx-ring { position: absolute; left: 0; top: 0; width: 200px; height: 200px; border-radius: 50%; box-shadow: inset 0 0 0 10px var(--l-orange); opacity: 0; transform-origin: 50% 50%; }
.lsn-sx-label {
  position: absolute; left: 0; right: 0; top: 0; height: 40px; line-height: 40px; text-align: center; transform-origin: 50% 50%;
  font-weight: 900; font-size: 32px; letter-spacing: .2px; color: var(--l-orange);
}
.lsn-sx-peek { position: absolute; left: 0; right: 0; top: 0; overflow: hidden; }
.lsn-sx-tony { position: absolute; }
.lsn-spark { position: absolute; left: 0; top: 0; pointer-events: none; }
.lsn-spark svg { width: 100%; height: 100%; display: block; }
.lsn-ember { position: absolute; left: 0; top: 0; border-radius: 50%; pointer-events: none; }

/* the streak chip (CSS 3D): built at its size, centred on its parent's origin */
.lsn-schip {
  /* its own tokens, so a host can build it outside .lsn (Lesson.streakChip) */
  --l-vest: var(--vest, #CF2A36); --l-paper: var(--paper, #FFFFFF); --l-orange: var(--orange, #FF9600);
  --l-orange-dk: #E08600; --l-gold: var(--gold, #FFC800); --l-line: var(--line, #E5E5E5); --l-muted: #AFAFAF;
  position: absolute; left: 0; top: 0; width: 0; height: 0;
}
.lsn-schip-persp { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.lsn-schip-disc { position: absolute; transform-style: preserve-3d; }
.lsn-schip-face {
  position: absolute; inset: 0; border-radius: 50%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.lsn-schip-face svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.lsn-schip-shade { position: absolute; inset: 0; border-radius: 50%; background: #000; opacity: 0; }
.lsn-schip-facet {
  position: absolute; left: 0; top: 0; background: color-mix(in srgb, var(--l-vest) 74%, black);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.lsn-schip-facet.is-insert { background: color-mix(in srgb, var(--l-paper) 90%, var(--l-vest)); }
.lsn-sc-red { fill: var(--l-vest); }
.lsn-sc-ring { fill: color-mix(in srgb, var(--l-vest) 80%, black); }
.lsn-sc-ins { fill: var(--l-paper); }
.lsn-sc-paper { fill: var(--l-paper); }
.lsn-sc-orange { fill: var(--l-orange); }
.lsn-sc-gold { fill: var(--l-gold); }
.lsn-sc-grey { fill: color-mix(in srgb, var(--l-line) 70%, var(--l-muted)); }
.lsn-sc-num {
  font-family: 'Nunito', ui-rounded, system-ui, sans-serif; font-weight: 900; font-size: 64px;
  fill: var(--l-paper); stroke: var(--l-orange-dk); stroke-width: 3.6px; paint-order: stroke; stroke-linejoin: round;
}
.lsn-sc-num.is-off { stroke: var(--l-muted); }
.lsn-schip.is-lit .lsn-sc-flick { animation: lsn-flame 760ms ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 92%; }
@keyframes lsn-flame { 0% { transform: scale(1, 1) skewX(0deg); } 50% { transform: scale(.97, 1.04) skewX(-2.5deg); } 100% { transform: scale(1.02, .98) skewX(2deg); } }
.lsn-week {
  position: absolute; left: 22px; right: 22px; top: 0; display: flex; justify-content: space-between;
  padding: 12px 14px 14px; border: 2px solid var(--l-line); border-radius: 16px; background: var(--l-paper);
}
.lsn-day { display: flex; flex-direction: column; align-items: center; gap: 7px; font-weight: 800; font-size: 13px; color: var(--l-muted); }
.lsn-day i {
  position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--l-line); color: #fff;
}
.lsn-day-fill { position: absolute; inset: 0; border-radius: 50%; background: var(--l-orange); transform: scale(0); }
.lsn-day i svg { position: relative; width: 16px; height: 16px; }
.lsn-day.is-today.is-on { color: var(--l-orange); }
.lsn-day.is-next.is-on i { background: var(--l-paper); box-shadow: inset 0 0 0 3px var(--l-orange); }
