/* learning/static/learning/cards.css — swipe flashcards (cards.js). Accent: --bc-accent on a parent. */
.bc { --bc-accent: #2E7D4F; --bc-again: #B5523B; display: grid; gap: 12px; max-width: 440px; margin: 0 auto;
  font-family: var(--font-body, system-ui, sans-serif); color: #23271F; }
.bc__head { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.bc__count { margin: 0; font-size: 14px; font-weight: 700; color: #585E50; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bc__meter { flex: 1; height: 6px; border-radius: 3px; background: #E8E6DE; overflow: hidden; }
.bc__meter i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--bc-accent); transition: width .4s ease; }
.bc__close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #E4E5DD; background: #fff;
  font-size: 18px; cursor: pointer; color: #23271F; }
.bc__stage { position: relative; min-height: 360px; touch-action: pan-y; perspective: 1400px; }
.bc__card { position: absolute; inset: 0; border-radius: 24px; cursor: grab; user-select: none; -webkit-user-select: none;
  transition: transform .26s ease, opacity .26s ease; outline: none; }
.bc__card:focus-visible .bc__face { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc-accent) 45%, transparent), 0 22px 44px -28px rgba(0, 0, 0, .5); }
.bc__card.is-dragging { transition: none; cursor: grabbing; }
.bc__card--behind { transform: scale(.94) translateY(14px); opacity: .55; pointer-events: none; }
.bc__card.is-out-right { transform: translateX(130%) rotate(16deg); opacity: 0; }
.bc__card.is-out-left { transform: translateX(-130%) rotate(-16deg); opacity: 0; }
.bc__inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2,.75,.25,1); }
.bc__card.is-turned .bc__inner { transform: rotateY(180deg); }
.bc__face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 34px 24px 30px; text-align: center; overflow-y: auto; border-radius: 24px; background: #fff;
  border: 1.5px solid #E6E4DC; box-shadow: 0 22px 44px -28px rgba(0, 0, 0, .5);
  -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.bc__face::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, var(--bc-accent), color-mix(in srgb, var(--bc-accent) 55%, #fff)); }
/* backface-visibility alone is unreliable in some browsers: swap the faces' visibility halfway through the turn too */
.bc__face { transition: visibility 0s .2s; }
.bc__face--back, .bc__card.is-turned .bc__face { visibility: hidden; }
.bc__card.is-turned .bc__face--back { visibility: visible; }
.bc__face--back { transform: rotateY(180deg); background: linear-gradient(180deg, color-mix(in srgb, var(--bc-accent) 6%, #fff), #fff 55%); }
.bc__chip { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 3px 11px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: color-mix(in srgb, var(--bc-accent) 12%, #fff); color: var(--bc-accent); }
.bc__front { margin: 0; font-size: clamp(44px, 13vw, 68px); line-height: 1.15; font-weight: 700; overflow-wrap: anywhere; }
.bc__front--mid { font-size: clamp(30px, 8vw, 42px); }
.bc__front--long { font-size: clamp(21px, 5.4vw, 26px); line-height: 1.35; font-weight: 650; }
.bc__front--xl { font-size: 18px; line-height: 1.45; font-weight: 600; text-align: left; }
.bc__front rt, .bc__mini rt { font-size: .45em; font-weight: 500; color: #7A7F72; }
.bc__sub { margin: 0; color: #6B7163; font-size: 15px; }
.bc__hint { position: absolute; bottom: 14px; margin: 0; font-size: 12.5px; color: #9A9E92; }
.bc__mini { margin: 0; font-size: 17px; font-weight: 650; color: #6B7163; line-height: 1.35; max-width: 100%; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bc__back { margin: 2px 0; font-size: 26px; line-height: 1.3; font-weight: 750; color: var(--bc-accent); overflow-wrap: anywhere; }
.bc__back--long { font-size: 19px; line-height: 1.45; font-weight: 650; }
.bc__lines { display: grid; gap: 4px; width: 100%; padding-top: 10px; border-top: 1px dashed #E2E0D7; }
.bc__line { margin: 0; font-size: 14.5px; line-height: 1.5; color: #3B4036; overflow-wrap: anywhere; }
.bc__play { margin-top: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid #E4E5DD;
  background: #FAF8F3; font-weight: 700; font-size: 14.5px; cursor: pointer; color: #23271F; }
.bc__tag { position: absolute; top: -10px; right: 14px; z-index: 3; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 700; background: #E8F3EC; color: #2E7D4F; }
.bc__tag--again { background: #F8E7E2; color: var(--bc-again); }
.bc__stamp { position: absolute; top: 18px; z-index: 2; padding: 4px 12px; border-radius: 8px; border: 3px solid;
  font-weight: 800; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; pointer-events: none; }
.bc__stamp--again { right: 16px; color: var(--bc-again); opacity: var(--again, 0); transform: rotate(10deg); }
.bc__stamp--know { left: 16px; color: var(--bc-accent); opacity: var(--know, 0); transform: rotate(-10deg); }
.bc__bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.bc__btn { min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1.5px solid #E4E5DD; background: #fff;
  font-weight: 700; font-size: 15px; cursor: pointer; color: #23271F; }
.bc__btn:disabled { opacity: .4; cursor: default; }
.bc__btn--again { color: var(--bc-again); border-color: #EBCBC1; }
.bc__btn--know { color: #fff; background: var(--bc-accent); border-color: var(--bc-accent); }
.bc__note { margin: 0; font-size: 13.5px; line-height: 1.5; color: #6B7163; text-align: center; }
.bc__live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bc__done { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; text-align: center; border-radius: 22px; background: #FAF8F3; border: 1.5px solid #E4E5DD; }
.bc__done .bc__btn { min-width: 200px; }
.bc__done-big { margin: 0; font-size: 26px; font-weight: 800; }
.bc__done-sub { margin: 0; font-size: 15px; line-height: 1.5; color: #585E50; }
@media (prefers-reduced-motion: reduce) { .bc__card, .bc__inner { transition: none; } }

/* The lesson button's pop-up */
.bc-open, .bc-open body { overflow: hidden; }
.bc-shade { position: fixed; inset: 0; z-index: 3500; background: rgba(28, 30, 24, .55); display: flex; align-items: center;
  justify-content: center; padding: 16px; }
.bc-pop { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; background: #F6F4EE;
  border-radius: 24px; padding: 16px; }

/* ── Swipe feedback: the card washes green (know) or coral (again) as it is dragged ── */
.bc__card::after { content: ''; position: absolute; inset: 0; border-radius: 24px; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, rgba(181,82,59,calc(var(--again, 0) * .22)), transparent 45%, transparent 55%, rgba(46,125,79,calc(var(--know, 0) * .22))); }
.bc__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .1s ease, filter .15s; }
.bc__btn:active:not(:disabled) { transform: scale(.96); }

/* ── Phones: the deck is a full-screen sheet — a tall card, big buttons in the thumb zone ── */
@media (max-width: 600px) {
  .bc-shade { padding: 0; align-items: stretch; background: rgba(28, 30, 24, .7); }
  .bc-pop { max-width: none; max-height: none; height: 100dvh; border-radius: 0; padding: calc(10px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; overflow: hidden; }
  .bc-pop .bc { flex: 1; min-height: 0; max-width: none; grid-template-rows: auto 1fr auto auto; }
  .bc-pop .bc__stage { min-height: 0; height: 100%; }
  .bc { gap: 10px; }
  .bc__stage { min-height: min(62vh, 520px); }
  .bc__face { padding: 40px 20px 34px; }
  .bc__bar { grid-template-columns: 1fr 64px 1fr; gap: 10px; }
  .bc__btn { min-height: 58px; border-radius: 18px; font-size: 16px; }
  .bc__btn--flip { padding: 0; font-size: 0; }
  .bc__btn--flip::before { content: '↻'; font-size: 24px; line-height: 1; }
  .bc__note { font-size: 12.5px; }
  .bc__front--long { font-size: 24px; }
  .bc__front--xl { font-size: 19px; }
  .bc__back { font-size: 28px; }
  .bc__back--long { font-size: 20px; }
  .bc__line { font-size: 15.5px; }
}

/* ── Nov 2026: a sharper deck — title + tools, clear counts, adjustable text (--bc-size), word + example audio ── */
.bc { --bc-size: 1; }
.bc__head { display: grid; gap: 8px; min-height: 0; }
.bc__titlerow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bc__title { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 750; letter-spacing: -.01em; color: #23271F; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc__tools { display: flex; gap: 6px; flex: none; }
.bc__tool { min-width: 38px; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid #E2E1D9; background: #fff; color: #3B4036;
  font: 750 13px/1 var(--font-body, system-ui, sans-serif); cursor: pointer; transition: border-color .15s, background .15s; }
.bc__tool:hover:not(:disabled) { border-color: var(--bc-accent); color: var(--bc-accent); }
.bc__tool:disabled { opacity: .35; cursor: default; }
.bc__tool--lg { font-size: 15px; }
.bc__tool--reset { font-size: 12.5px; }
.bc__head .bc__close { width: 40px; height: 40px; }
.bc__statrow { display: flex; align-items: center; gap: 12px; }
.bc__count { display: flex; gap: 6px; flex: none; }
.bc__stat { display: inline-flex; align-items: baseline; gap: 3px; padding: 3px 9px; border-radius: 999px; background: #F2F1EC; font-size: 12px; font-weight: 600; color: #5C6157; }
.bc__stat b { font-size: 13px; font-weight: 800; color: #23271F; font-variant-numeric: tabular-nums; }
.bc__stat--known { background: #E8F3EC; } .bc__stat--known b { color: #2E7D4F; }
.bc__stat--again { background: #F8E7E2; } .bc__stat--again b { color: var(--bc-again); }
.bc__meter { height: 5px; }

/* the card: crisper edge and shadow, a thin accent rail */
.bc__face { border: 1px solid #DEDCD3; box-shadow: 0 1px 0 #ECEAE3, 0 20px 40px -28px rgba(20,24,18,.55); }
.bc__face::before { height: 5px; }
.bc__chip { top: 16px; font-size: 11px; letter-spacing: .08em; }
.bc__front { font-size: calc(clamp(44px, 13vw, 68px) * var(--bc-size)); letter-spacing: -.01em; }
.bc__front--mid { font-size: calc(clamp(30px, 8vw, 42px) * var(--bc-size)); }
.bc__front--long { font-size: calc(clamp(21px, 5.4vw, 26px) * var(--bc-size)); }
.bc__front--xl { font-size: calc(18px * var(--bc-size)); }
.bc__sub { font-size: calc(15px * var(--bc-size)); }
.bc__mini { font-size: calc(17px * var(--bc-size)); }
.bc__back { font-size: calc(26px * var(--bc-size)); }
.bc__back--long { font-size: calc(19px * var(--bc-size)); }
.bc__line { font-size: calc(14.5px * var(--bc-size)); text-align: left; }
.bc__lines { text-align: left; }
.bc__plays { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.bc__play { display: inline-flex; align-items: center; gap: 7px; margin: 0; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--bc-accent) 35%, #E4E5DD); background: color-mix(in srgb, var(--bc-accent) 7%, #fff);
  color: var(--bc-accent); font: 700 13.5px/1 var(--font-body, system-ui, sans-serif); cursor: pointer; }
.bc__play:hover { background: var(--bc-accent); color: #fff; }
.bc__play-i { font-size: 12px; }
.bc__play--ex { border-color: #E2E1D9; background: #fff; color: #3B4036; }
.bc__play--front { position: absolute; bottom: 40px; min-height: 36px; padding: 0 12px; }
.bc__done { border: 1px solid #DEDCD3; box-shadow: 0 20px 40px -28px rgba(20,24,18,.55); }
@media (max-width: 600px) {
  /* the deck's name gets its own line (it read "This les…" between the tools); tools + ✕ sit under it */
  .bc__titlerow { flex-wrap: wrap; row-gap: 6px; }
  .bc__title { font-size: 14px; flex: 1 1 100%; white-space: normal; overflow: visible; line-height: 1.3; }
  .bc__titlerow .bc__tools { flex: 1 1 auto; }
  .bc__tool--reset { padding: 0 8px; }
  .bc__statrow { flex-wrap: wrap; gap: 8px; }
  .bc__meter { flex: 1 1 100%; order: 2; }
}

/* ── Full screen (⛶ / F): the browser's own (:fullscreen) or, where an element can't go full screen (iPhone), a fixed
   sheet (.bc--full). One big card in the middle, the counts above, the buttons below, larger text. ── */
.bc-fullsheet, .bc-fullsheet body { overflow: hidden; }
.bc.bc--fullscreen { position: fixed; inset: 0; z-index: 4000; width: 100%; max-width: none; max-height: none; height: 100dvh; margin: 0;
  border-radius: 0; overflow: hidden; background: #F6F4EE; box-sizing: border-box;
  padding: calc(14px + env(safe-area-inset-top)) max(16px, calc((100vw - 980px) / 2)) calc(16px + env(safe-area-inset-bottom));
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; gap: 14px; }
.bc.bc--fullscreen:fullscreen { position: static; }
.bc.bc--fullscreen::backdrop { background: #F6F4EE; }
.bc.bc--fullscreen .bc__stage { min-height: 0; height: 100%; width: 100%; max-width: 860px; justify-self: center; }
.bc.bc--fullscreen .bc__bar { width: 100%; max-width: 640px; justify-self: center; }
.bc.bc--fullscreen .bc__face { padding: clamp(36px, 6vh, 64px) clamp(24px, 5vw, 64px); }
.bc.bc--fullscreen .bc__front { font-size: calc(clamp(44px, 9vmin, 96px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__front--mid { font-size: calc(clamp(34px, 6.5vmin, 68px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__front--long { font-size: calc(clamp(26px, 4.4vmin, 46px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__front--xl { font-size: calc(clamp(20px, 3.4vmin, 34px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__back { font-size: calc(clamp(30px, 5.5vmin, 56px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__back--long { font-size: calc(clamp(22px, 3.6vmin, 36px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__sub, .bc.bc--fullscreen .bc__line { font-size: calc(clamp(16px, 2.4vmin, 24px) * var(--bc-size, 1)); }
.bc.bc--fullscreen .bc__mini { font-size: calc(clamp(18px, 2.8vmin, 28px) * var(--bc-size, 1)); }
.bc__tool--full[aria-pressed="true"] { background: #23271F; border-color: #23271F; color: #fff; }

/* ── Phase 1 card faces: listen (a big ▶, no text), code (monospace, indentation kept), rich backs ── */
.bc__play--listen { width: 120px; height: 120px; border-radius: 50%; justify-content: center; font-size: 0; gap: 0;
  background: var(--bc-accent); color: #fff; border: 0; box-shadow: 0 16px 30px -14px color-mix(in srgb, var(--bc-accent) 70%, transparent); }
.bc__play--listen .bc__play-i { font-size: 44px; line-height: 1; margin-left: 6px; }
.bc__play--listen span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bc__codefront, .bc__mini--code { margin: 0; max-width: 100%; overflow-x: auto; padding: 14px 16px; border-radius: 14px; text-align: left;
  background: #1C1F1A; color: #F3F1EA; font: calc(15px * var(--bc-size, 1))/1.55 'JetBrains Mono', ui-monospace, Menlo, monospace; white-space: pre; }
.bc__mini--code { font-size: calc(12.5px * var(--bc-size, 1)); padding: 10px 12px; opacity: .85; }
.bc__back mark, .bc__line mark, .bc__front mark { background: color-mix(in srgb, var(--bc-accent) 22%, #fff); color: inherit; border-radius: 4px; padding: 0 .1em; }
.bc__back rt, .bc__line rt { font-size: .5em; color: #6B7163; }
.bc__back s, .bc__line s { text-decoration-color: #C0392B; }
.bc__card.has-back-tone .bc__face--back { --bc-accent: var(--bc-back-accent); }

/* ── The deck's own question (start over): inside the deck, so it works in full screen and matches the cards ── */
.bc { position: relative; }
.bc__ask { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; border-radius: inherit;
  background: rgba(28, 30, 24, .45); backdrop-filter: blur(2px); animation: bc-fade .18s ease; }
@keyframes bc-fade { from { opacity: 0; } }
.bc__ask-card { width: min(420px, 100%); padding: 20px 20px 16px; border-radius: 20px; background: #fff; color: #23271F;
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .55); text-align: left; }
.bc__ask-h { margin: 0 0 6px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.bc__ask-t { margin: 0 0 16px; font-size: 15px; line-height: 1.5; color: #585E50; }
.bc__ask-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bc__ask-row .bc__btn { min-height: 48px; }
.bc.bc--fullscreen .bc__ask { border-radius: 0; }

/* ── Easy to drive (Nov 2026): ↩ Undo beside the meter, the keys named where there is a keyboard, and the cards that
   needed a second look on the end screen ── */
.bc__undo { flex: none; min-height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid #E2E1D9; background: #fff; color: #3B4036;
  font: 700 12.5px/1 inherit; cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s, opacity .15s; }
.bc__undo:hover:not(:disabled) { border-color: var(--bc-accent); color: var(--bc-accent); }
.bc__undo:disabled { opacity: .35; cursor: default; }
.bc__keys { display: none; margin: 0; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: 12px; color: #7A7F72; }
.bc__keys kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid #DAD8CE;
  background: #fff; font: 700 10.5px/1 ui-monospace, 'JetBrains Mono', monospace; color: #4A4F44; }
@media (hover: hover) and (pointer: fine) { .bc__keys { display: flex; } }
.bc.bc--fullscreen .bc__keys { color: #8C9184; }
.bc__done { overflow-y: auto; justify-content: safe center; }
.bc__done-k { margin: 6px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--bc-again); }
.bc__done-list { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.bc__done-list li { padding: 4px 10px; border-radius: 999px; background: #F8E7E2; font-size: 13.5px; font-weight: 600; color: #5A2E22; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc__done-list .bc__done-more { background: transparent; color: #6B7163; }
@media (max-width: 600px) { .bc__undo { min-height: 34px; margin-left: auto; } }
