/* ══════════════════════════════════════════════════════════════
   TABÚ — the speaking game, projected in class

   Ported from Sandra's classroom-tested prototype
   (tabu/tabu-espanol.html) on 2026-10-28 and repainted the same
   day from the references she sent: a strip of watercolour
   swatches, a sheet of marbled paper, a folk mandala.

   Three things about this file are deliberate:

   1. Everything is scoped to #tabu-screen, so none of it reaches
      the rest of the app.
   2. Every class is prefixed tb-. The prototype used names like
      .card, .chip, .topic, .stage and .progress, all of which
      already mean something else in css/app.css. Scoping alone
      would not have saved them: app.css would still style them
      from the outside.
   3. EVERY COLOUR IS A VARIABLE DECLARED IN THE ONE BLOCK BELOW.
      Nothing further down this file names a colour. The redesign
      branch is converting the app to css/tokens.css (issue #9),
      and keeping the palette in a single block means that
      conversion is a remap of one block rather than a read of
      four hundred lines.

   How the colour works. The pastels are the PAPER and the
   saturated hues are the INK, which is why there are three
   variables per level rather than one. A projector throws a wash
   as light and an ink as colour: pale text on a wall is unreadable
   from the back row, so no text ever sits on a wash alone. The
   five forbidden words on a card each take a different tint from
   the watercolour strip, and the cards rotate through four sets of
   corner radii, so a deck of a hundred does not read as the same
   card drawn a hundred times.

   The four level colours stay what they were — they are how the
   class reads difficulty at a glance:
     1 Principiante green · 2 Intermedio amber
     3 Avanzado     pink  · 4 Experto    purple
══════════════════════════════════════════════════════════════ */

#tabu-screen {
  /* ── the room ── */
  --tb-bg:        #241F57;
  --tb-bg-dot:    rgba(255,255,255,.07);
  --tb-marble-1:  rgba(226,52,104,.30);
  --tb-marble-2:  rgba(242,160,7,.22);
  --tb-marble-3:  rgba(16,165,143,.26);
  --tb-marble-4:  rgba(123,79,232,.34);
  --tb-marble-5:  rgba(45,111,168,.22);
  --tb-card:      var(--c-surface, #fff);
  --tb-ink:       var(--c-text, #1F2850);
  --tb-ink-soft:  var(--c-text-soft, #686C86);
  --tb-on-bg:     #fff;
  --tb-ghost:     rgba(255,255,255,.14);
  --tb-ghost-hi:  rgba(255,255,255,.24);
  --tb-shadow:    rgba(0,0,0,.2);
  --tb-shadow-lo: rgba(0,0,0,.18);
  --tb-veil:      rgba(26,21,70,.72);
  --tb-sun:       var(--c-secondary, #DE826A);
  --tb-sun-deep:  #C79A00;
  --tb-night:     #1A1D45;

  /* ── the four levels: ink, its shadow, its paper ── */
  --tb-l1: #10A58F;  --tb-l1-deep: #0A7465;  --tb-l1-wash: #D7F1E9;
  --tb-l2: #F2A007;  --tb-l2-deep: #B06E00;  --tb-l2-wash: #FCEBC9;
  --tb-l3: #E23468;  --tb-l3-deep: #9E1745;  --tb-l3-wash: #FBDCE5;
  --tb-l4: #7B4FE8;  --tb-l4-deep: #5331A8;  --tb-l4-wash: #E5DDFB;
  --tb-lvl:      var(--tb-l1);
  --tb-lvl-deep: var(--tb-l1-deep);
  --tb-lvl-wash: var(--tb-l1-wash);
  /* Level 2 is the one light enough to need dark text on it. */
  --tb-on-lvl:   #fff;
  --tb-on-l2:    #2E2200;

  /* ── the watercolour strip: five papers and their inks ── */
  --tb-w0: #FBDCE5;  --tb-i0: #B0123F;
  --tb-w1: #FCEBC9;  --tb-i1: #9C6406;
  --tb-w2: #F7F3C4;  --tb-i2: #7A6B0C;
  --tb-w3: #D7F1E9;  --tb-i3: #0A7465;
  --tb-w4: #DCE8FB;  --tb-i4: #2A5F96;
  --tb-w5: #E5DDFB;  --tb-i5: #5331A8;

  position: relative;
  border-radius: var(--radius-lg, 22px);
  overflow: hidden;
  color: var(--tb-on-bg);
  background-color: var(--tb-bg);
  /* Marbled paper: four washes bleeding into each other, with the
     prototype's dot grid still on top for tooth. */
  background-image:
    radial-gradient(58% 44% at 10% 16%, var(--tb-marble-1), transparent 70%),
    radial-gradient(54% 40% at 90% 10%, var(--tb-marble-2), transparent 72%),
    radial-gradient(62% 50% at 80% 88%, var(--tb-marble-3), transparent 70%),
    radial-gradient(52% 44% at 18% 86%, var(--tb-marble-4), transparent 72%),
    radial-gradient(46% 38% at 54% 48%, var(--tb-marble-5), transparent 74%),
    radial-gradient(var(--tb-bg-dot) 2px, transparent 2.5px);
  background-size: auto, auto, auto, auto, auto, 28px 28px;
}
#tabu-screen[data-level="1"] { --tb-lvl: var(--tb-l1); --tb-lvl-deep: var(--tb-l1-deep); --tb-lvl-wash: var(--tb-l1-wash); }
#tabu-screen[data-level="2"] { --tb-lvl: var(--tb-l2); --tb-lvl-deep: var(--tb-l2-deep); --tb-lvl-wash: var(--tb-l2-wash); --tb-on-lvl: var(--tb-on-l2); }
#tabu-screen[data-level="3"] { --tb-lvl: var(--tb-l3); --tb-lvl-deep: var(--tb-l3-deep); --tb-lvl-wash: var(--tb-l3-wash); }
#tabu-screen[data-level="4"] { --tb-lvl: var(--tb-l4); --tb-lvl-deep: var(--tb-l4-deep); --tb-lvl-wash: var(--tb-l4-wash); }

/* Projected: fill the screen, drop the rounded corners. */
#tabu-screen:fullscreen { border-radius: 0; height: 100%; }
#tabu-screen:fullscreen .tb-screen { height: 100%; }

#tabu-screen *, #tabu-screen *::before, #tabu-screen *::after { box-sizing: border-box; }
#tabu-screen button { font: inherit; cursor: pointer; }
/* The border reset is deliberately weak. Written as `#tabu-screen
   button { border: 0 }` it outranked every component's own border —
   an id beats a class — so .tb-chip, .tb-mode-btn and the rest asked
   for a 3px outline and silently got none. Keeping it at type-level
   specificity lets any class below say otherwise. */
:where(#tabu-screen) button { border: 0; }
#tabu-screen button:focus-visible { outline: 4px solid var(--tb-sun); outline-offset: 3px; }

.tb-screen { display: none; flex-direction: column; min-height: min(76vh, 720px); }
.tb-screen.tb-on { display: flex; }

/* ---------- Instrucciones ---------- */
#tb-intro { overflow-y: auto; padding: clamp(14px,2.5vw,32px); }
.tb-intro-card {
  background: var(--tb-card); color: var(--tb-ink);
  border-radius: 40px 28px 36px 30px; max-width: 980px; width: 100%;
  padding: clamp(24px,3.4vw,48px) clamp(24px,4vw,56px);
  box-shadow: 0 14px 0 var(--tb-shadow-lo);
  position: relative; overflow: hidden; margin: auto;
}
.tb-stripes { position: absolute; inset: 0 0 auto 0; height: 16px; display: flex; }
.tb-stripes span { flex: 1; }
.tb-stripes span:nth-child(1) { background: var(--tb-l1); }
.tb-stripes span:nth-child(2) { background: var(--tb-l2); }
.tb-stripes span:nth-child(3) { background: var(--tb-l3); }
.tb-stripes span:nth-child(4) { background: var(--tb-l4); }
.tb-logo { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.tb-logo-badge {
  background: var(--tb-l3); color: var(--tb-card); font-weight: 800;
  font-size: clamp(1.1rem,2vw,1.5rem); padding: 2px 16px;
  border-radius: 58% 42% 46% 54% / 56% 50% 50% 44%; transform: rotate(-4deg);
}
.tb-intro-card h2.tb-h1 {
  font-size: clamp(2.2rem,4.6vw,3.5rem); line-height: 1;
  margin: 6px 0 12px; font-weight: 800;
}
.tb-steps {
  list-style: none; margin: 0 0 22px; padding: 0;
  display: grid; gap: 7px; counter-reset: s;
}
.tb-steps li {
  counter-increment: s; display: grid; grid-template-columns: auto 1fr;
  gap: 16px; align-items: start;
  font-size: clamp(1rem,1.6vw,1.26rem); line-height: 1.3; font-weight: 400;
}
.tb-steps li::before {
  content: counter(s); display: grid; place-items: center;
  width: 1.8em; height: 1.8em; border-radius: 54% 46% 50% 50% / 50% 54% 46% 50%;
  font-weight: 800; color: var(--tb-card); background: var(--tb-l1); margin-top: -.1em;
}
.tb-steps li:nth-child(3n+2)::before { background: var(--tb-l2); color: var(--tb-on-l2); }
.tb-steps li:nth-child(3n)::before   { background: var(--tb-l3); }
.tb-steps strong { font-weight: 700; }
.tb-steps[hidden] { display: none; }
/* The tense-challenge rule is hidden while the challenge is off. It needs
   saying explicitly: the rule above gives every li `display:grid`, and an
   author rule beats the browser's own [hidden]{display:none}, so without
   this the step showed even when the game had no tense challenge — the
   prototype has the same slip. */
.tb-steps li[hidden] { display: none; }
.tb-modes { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.tb-mode-btn {
  background: transparent; color: var(--tb-ink-soft);
  border: 3px solid currentColor; border-radius: 999px;
  padding: 3px 16px; font-weight: 700; font-size: clamp(.88rem,1.3vw,1.02rem);
}
.tb-mode-btn:hover { color: var(--tb-ink); }
.tb-mode-btn[aria-selected="true"] {
  background: var(--tb-ink); border-color: var(--tb-ink); color: var(--tb-card);
}
.tb-intro-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.tb-btn-play {
  background: var(--tb-l3); color: var(--tb-card); font-weight: 800;
  font-size: clamp(1.4rem,2.6vw,2rem); padding: 10px 40px;
  border-radius: 46% 54% 50% 50% / 50% 50% 54% 46%;
  box-shadow: 0 6px 0 var(--tb-l3-deep); transition: transform .08s;
}
.tb-btn-play:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--tb-l3-deep); }
.tb-intro-body { display: grid; gap: 4px 32px; }
@media (min-width: 1050px) {
  .tb-intro-card { max-width: 1280px; }
  .tb-intro-body { grid-template-columns: minmax(0,1.75fr) minmax(0,1fr); align-items: start; }
  .tb-intro-side { position: sticky; top: 0; }
  .tb-intro-side .tb-setup-row { flex-direction: column; align-items: flex-start; }
  .tb-intro-side .tb-steps { margin-bottom: 0; }
}
.tb-setup {
  display: grid; gap: 16px; margin: 0 0 20px; padding: 16px 18px;
  border-radius: 26px 18px 24px 20px; border: 3px dashed var(--tb-l3-wash);
}
.tb-setup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tb-setup-label { font-weight: 700; color: var(--tb-ink); font-size: clamp(.95rem,1.5vw,1.1rem); }
.tb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--tb-ink-soft);
  border: 3px solid currentColor; border-radius: 999px;
  padding: 3px 14px; font-weight: 700; font-size: clamp(.9rem,1.45vw,1.05rem);
}
.tb-chip:hover { color: var(--tb-ink); }
.tb-chip i { width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--tb-ink-soft)); }
.tb-chip[aria-pressed="true"] { background: var(--c, var(--tb-ink)); border-color: var(--c, var(--tb-ink)); color: var(--tb-card); }
.tb-chip[aria-pressed="true"] i { background: var(--tb-card); }
.tb-chip[data-level="2"][aria-pressed="true"]   { color: var(--tb-on-l2); }
.tb-chip[data-level="2"][aria-pressed="true"] i { background: var(--tb-on-l2); }
.tb-chip[data-time][aria-pressed="true"],
.tb-chip[data-deck][aria-pressed="true"] { color: var(--tb-card); }
/* The same chips, used on the dark backdrop inside the menu. */
.tb-chip-dark { color: var(--tb-on-bg); }
.tb-chip-dark:hover { color: var(--tb-on-bg); background: var(--tb-ghost); }
.tb-chip-dark[aria-pressed="true"] { background: var(--tb-sun); border-color: var(--tb-sun); color: var(--tb-night); }
.tb-tense-select {
  font: inherit; font-weight: 700; font-size: clamp(.9rem,1.45vw,1.05rem);
  color: var(--tb-ink); background: var(--tb-card);
  border: 3px solid var(--tb-ink-soft); border-radius: 999px;
  padding: 4px 14px; max-width: 100%;
}
.tb-tense-select:focus-visible { outline: 4px solid var(--tb-sun); outline-offset: 2px; }
.tb-setup-note { color: var(--tb-ink-soft); font-weight: 600; font-size: clamp(.95rem,1.5vw,1.1rem); }
.tb-intro-links { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 0; }
.tb-sheet-link {
  background: none; border: 0; padding: 0;
  color: var(--tb-l4); font-weight: 700; text-decoration: underline;
  font-size: clamp(.95rem,1.5vw,1.08rem); cursor: pointer;
}
.tb-sheet-link:hover { color: var(--tb-l3); }

/* ---------- Juego ---------- */
#tb-game { padding: clamp(10px,2vw,24px) clamp(12px,3vw,40px); position: relative; }
.tb-topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-level-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--tb-lvl); color: var(--tb-on-lvl); font-weight: 800;
  border-radius: 54% 46% 48% 52% / 52% 54% 46% 48%;
  padding: 5px 18px; font-size: clamp(1rem,1.8vw,1.35rem);
}
.tb-level-pill svg { width: 16px; height: 16px; flex: none; }
.tb-level-pill:hover { filter: brightness(1.08); }
.tb-score {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--tb-sun); color: var(--tb-night); font-weight: 800;
  border-radius: 48% 52% 54% 46% / 54% 46% 52% 48%;
  padding: 5px 16px; font-size: clamp(1rem,1.8vw,1.3rem);
}
.tb-score svg { width: 19px; height: 19px; flex: none; }
.tb-score b { font-variant-numeric: tabular-nums; min-width: 1.1em; text-align: center; }
.tb-progress {
  flex: 1; min-width: 120px; display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: clamp(.95rem,1.6vw,1.25rem);
}
.tb-bar { flex: 1; height: 12px; border-radius: 999px; background: var(--tb-ghost); overflow: hidden; }
.tb-bar i { display: block; height: 100%; width: 0; background: var(--tb-sun); border-radius: 999px; transition: width .3s; }
.tb-tool {
  background: var(--tb-ghost); color: var(--tb-on-bg); font-weight: 700;
  padding: 6px 16px; border-radius: 999px; font-size: 1rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.tb-tool:hover { background: var(--tb-ghost-hi); }
.tb-tool svg { width: 18px; height: 18px; }

.tb-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: clamp(10px,2vw,24px) 0; min-height: 0;
}
.tb-card {
  background: var(--tb-card); color: var(--tb-ink);
  width: 100%; max-width: 1100px;
  border-radius: 44px 32px 40px 34px;
  box-shadow: 0 16px 0 var(--tb-shadow);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
}
/* Six cuts of the same card, so a dealt deck looks painted rather than
   stamped. The variant rides on the card's position in the deck, so a
   card looks the same every time you come back to it. */
.tb-card[data-v="1"] { border-radius: 30px 46px 32px 42px; }
.tb-card[data-v="2"] { border-radius: 40px 36px 46px 30px; }
.tb-card[data-v="3"] { border-radius: 34px 42px 30px 46px; }
.tb-card[data-v="4"] { border-radius: 46px 30px 42px 36px; }
.tb-card[data-v="5"] { border-radius: 36px 44px 34px 40px; }
.tb-card-top {
  background: var(--tb-lvl); color: var(--tb-on-lvl); text-align: center;
  padding: clamp(14px,2.4vw,30px) 20px clamp(26px,3.6vw,44px); position: relative;
}
/* A deckled edge, cut with a row of card-coloured scallops. Paper torn
   by hand, not a ruled line. */
.tb-card-top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 15px;
  background: radial-gradient(circle at 12px 15px, var(--tb-card) 11.4px, transparent 12px) repeat-x;
  background-size: 24px 15px;
}
.tb-topic {
  display: inline-block; font-weight: 700; font-size: clamp(1rem,1.7vw,1.3rem);
  background: var(--tb-ghost-hi); border-radius: 52% 48% 46% 54% / 50% 54% 46% 50%;
  padding: 3px 18px; margin-bottom: 4px; transform: rotate(-1.2deg);
}
.tb-target {
  font-weight: 800; line-height: .95; margin: 0;
  font-size: clamp(3rem,9vw,7.6rem); overflow-wrap: anywhere;
  text-shadow: 0 4px 0 var(--tb-shadow-lo);
}
.tb-target.tb-long { font-size: clamp(2.4rem,6.4vw,5.6rem); }
.tb-article { display: block; font-size: .38em; font-weight: 700; opacity: .85; line-height: 1.2; }
.tb-challenge {
  background: var(--tb-sun); color: var(--tb-night);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: 2px 14px; padding: 10px 20px; font-weight: 800;
  font-size: clamp(1.25rem,2.6vw,2rem); text-align: center;
}
.tb-challenge span { font-weight: 500; font-size: .72em; }
.tb-card.tb-has-tense .tb-target { font-size: clamp(2.6rem,7.4vw,6.2rem); }
.tb-card.tb-has-tense .tb-target.tb-long { font-size: clamp(2.1rem,5.4vw,4.6rem); }
.tb-card.tb-has-tense .tb-forbidden-wrap { padding-top: clamp(12px,2vw,24px); padding-bottom: clamp(14px,2.2vw,28px); }
.tb-forbidden-wrap { padding: clamp(16px,2.6vw,32px) clamp(16px,3vw,40px) clamp(20px,3vw,40px); }
.tb-forbidden-label {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 800; color: var(--tb-i0);
  font-size: clamp(1.1rem,2vw,1.6rem); margin: 0 0 14px;
}
.tb-forbidden-label svg { width: 1.3em; height: 1.3em; }
.tb-forbidden {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px,1.4vw,16px);
}
.tb-forbidden li {
  background: var(--tb-w0); color: var(--tb-ink); border: 3px solid var(--tb-i0);
  border-radius: 56% 44% 48% 52% / 48% 52% 48% 52%;
  padding: 5px clamp(16px,2.1vw,28px);
  font-weight: 700; font-size: clamp(1.4rem,3.1vw,2.5rem); line-height: 1.25;
  display: inline-flex; align-items: center; gap: 10px;
}
/* Five words, five papers from the watercolour strip, five slightly
   different hand positions. */
.tb-forbidden li[data-b="1"] { background: var(--tb-w1); border-color: var(--tb-i1); border-radius: 46% 54% 52% 48% / 54% 46% 54% 46%; transform: rotate(.9deg); }
.tb-forbidden li[data-b="2"] { background: var(--tb-w3); border-color: var(--tb-i3); border-radius: 52% 48% 44% 56% / 46% 54% 46% 54%; transform: rotate(-.7deg); }
.tb-forbidden li[data-b="3"] { background: var(--tb-w4); border-color: var(--tb-i4); border-radius: 44% 56% 54% 46% / 52% 48% 52% 48%; transform: rotate(1.1deg); }
.tb-forbidden li[data-b="4"] { background: var(--tb-w5); border-color: var(--tb-i5); border-radius: 54% 46% 50% 50% / 50% 52% 48% 50%; transform: rotate(-1deg); }
.tb-forbidden li[data-b="0"] { transform: rotate(-1.3deg); }
.tb-forbidden li::before {
  content: ""; width: .5em; height: .5em; border-radius: 50%; flex: none;
  border: 4px solid var(--tb-i0);
  background: linear-gradient(135deg,transparent 42%,var(--tb-i0) 42%,var(--tb-i0) 58%,transparent 58%);
}
.tb-forbidden li[data-b="1"]::before { border-color: var(--tb-i1); background: linear-gradient(135deg,transparent 42%,var(--tb-i1) 42%,var(--tb-i1) 58%,transparent 58%); }
.tb-forbidden li[data-b="2"]::before { border-color: var(--tb-i3); background: linear-gradient(135deg,transparent 42%,var(--tb-i3) 42%,var(--tb-i3) 58%,transparent 58%); }
.tb-forbidden li[data-b="3"]::before { border-color: var(--tb-i4); background: linear-gradient(135deg,transparent 42%,var(--tb-i4) 42%,var(--tb-i4) 58%,transparent 58%); }
.tb-forbidden li[data-b="4"]::before { border-color: var(--tb-i5); background: linear-gradient(135deg,transparent 42%,var(--tb-i5) 42%,var(--tb-i5) 58%,transparent 58%); }

.tb-controls { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.tb-btn-prev {
  background: var(--tb-ghost); color: var(--tb-on-bg); font-weight: 700;
  font-size: clamp(1.05rem,1.9vw,1.4rem); padding: 10px 24px; border-radius: 999px;
}
.tb-btn-prev:hover { background: var(--tb-ghost-hi); }
.tb-btn-prev:disabled { opacity: .35; cursor: default; }
.tb-btn-skip {
  background: transparent; color: var(--tb-on-bg); font-weight: 700;
  border: 3px solid var(--tb-ghost-hi);
  font-size: clamp(1.05rem,1.9vw,1.4rem); padding: 8px 24px;
  border-radius: 48% 52% 52% 48% / 52% 48% 52% 48%;
}
.tb-btn-skip:hover { background: var(--tb-ghost); }
.tb-btn-next {
  background: var(--tb-sun); color: var(--tb-night); font-weight: 800;
  font-size: clamp(1.4rem,2.8vw,2.2rem); padding: 10px 48px;
  border-radius: 50% 50% 46% 54% / 54% 46% 50% 50%;
  box-shadow: 0 7px 0 var(--tb-sun-deep); transition: transform .08s;
}
.tb-btn-next:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--tb-sun-deep); }

/* ---------- Temporizador ---------- */
.tb-timer { display: flex; align-items: center; gap: 6px; }
.tb-timer-main {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--tb-card); color: var(--tb-ink); border-radius: 999px;
  padding: 6px 20px 6px 12px; font-weight: 700;
  box-shadow: 0 6px 0 var(--tb-shadow); transition: background .2s, color .2s;
}
.tb-timer-main svg { width: 30px; height: 30px; color: var(--tb-l1); flex: none; }
.tb-timer-time {
  font-size: clamp(1.5rem,3vw,2.2rem); font-weight: 800;
  font-variant-numeric: tabular-nums; min-width: 2.4em; text-align: left; line-height: 1.2;
}
.tb-timer-act { font-size: clamp(.9rem,1.5vw,1.1rem); color: var(--tb-ink-soft); min-width: 4.4em; text-align: left; }
.tb-timer-reset {
  background: var(--tb-ghost); color: var(--tb-on-bg);
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
}
.tb-timer-reset:hover { background: var(--tb-ghost-hi); }
.tb-timer-reset svg { width: 22px; height: 22px; }
.tb-timer.tb-running .tb-timer-main { box-shadow: inset 0 0 0 4px var(--tb-l1), 0 6px 0 var(--tb-shadow); }
.tb-timer.tb-warn .tb-timer-main,
.tb-timer.tb-done .tb-timer-main { background: var(--tb-l3); color: var(--tb-card); }
.tb-timer.tb-warn .tb-timer-main svg, .tb-timer.tb-warn .tb-timer-act,
.tb-timer.tb-done .tb-timer-main svg, .tb-timer.tb-done .tb-timer-act { color: var(--tb-card); }
.tb-timer.tb-warn .tb-timer-main { animation: tb-pulse 1s ease-in-out infinite; }
@keyframes tb-pulse { 50% { transform: scale(1.07); } }
.tb-timeup {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(-7deg);
  background: var(--tb-sun); color: var(--tb-night); font-weight: 800; text-align: center;
  font-size: clamp(1.8rem,6vw,4.4rem); line-height: 1.05;
  padding: 12px clamp(18px,3vw,36px); border-radius: 30px 22px 28px 24px;
  border: 6px solid var(--tb-night);
  box-shadow: 0 10px 0 var(--tb-shadow); pointer-events: none;
  animation: tb-stamp .55s cubic-bezier(.3,1.6,.5,1);
}
.tb-timeup span { display: block; font-size: .46em; margin-top: 2px; }
@keyframes tb-stamp { from { transform: translate(-50%,-50%) rotate(-25deg) scale(2.4); opacity: 0; } }
.tb-card.tb-shake { animation: tb-shake .5s; }
@keyframes tb-shake {
  20% { transform: translateX(-14px) rotate(-1deg); }
  40% { transform: translateX(12px) rotate(1deg); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .tb-timer.tb-warn .tb-timer-main, .tb-card.tb-shake, .tb-timeup { animation: none; }
}
.tb-hint { text-align: center; opacity: .75; font-weight: 600; font-size: .95rem; margin: 10px 0 0; }
#tabu-screen kbd { font-family: inherit; background: var(--tb-ghost); border-radius: 6px; padding: 0 7px; }

/* ---------- Cambiar de nivel · Más ---------- */
/* Fixed, not absolute. The game screen is taller than a laptop
   viewport, so a panel anchored to the screen opened below the fold:
   the teacher pressed Nivel and nothing appeared to happen. Fixed
   covers the viewport, and in fullscreen the screen IS the viewport,
   so the same rule holds for the projector. */
.tb-panel {
  position: fixed; inset: 0; z-index: 60;
  background: var(--tb-veil);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px,3vw,32px); overflow-y: auto;
}
.tb-panel[hidden] { display: none; }
.tb-panel-card {
  background: var(--tb-card); color: var(--tb-ink);
  border-radius: 36px 26px 32px 28px; width: 100%; max-width: 620px;
  padding: clamp(20px,3vw,34px); box-shadow: 0 14px 0 var(--tb-shadow);
  margin: auto;
}
.tb-panel-card h3 {
  margin: 0 0 16px; font-weight: 800; font-size: clamp(1.3rem,2.4vw,1.8rem);
}
.tb-panel-card .tb-setup-row { margin-bottom: 16px; }
.tb-panel-card .tb-chip-dark { color: var(--tb-ink-soft); }
.tb-panel-card .tb-chip-dark:hover { color: var(--tb-ink); background: transparent; }
.tb-panel-card .tb-chip-dark[aria-pressed="true"] { background: var(--tb-night); border-color: var(--tb-night); color: var(--tb-card); }
.tb-jumps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); }
.tb-jump {
  display: grid; gap: 1px; justify-items: start; text-align: left;
  background: var(--tb-card); color: var(--tb-ink);
  border: 4px solid var(--c); border-radius: 26px 18px 24px 20px;
  padding: 10px 14px; font-weight: 700;
}
.tb-jump:hover { background: var(--c); color: var(--tb-card); }
.tb-jump b { font-size: 1.5rem; line-height: 1; color: var(--c); }
.tb-jump:hover b { color: var(--tb-card); }
.tb-jump span { font-size: 1rem; }
.tb-jump em { font-style: normal; font-weight: 600; font-size: .85rem; opacity: .72; }
.tb-panel-note { color: var(--tb-ink-soft); font-size: 1rem; margin: 14px 0 4px; line-height: 1.45; }
.tb-panel-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tb-panel-stack { display: grid; gap: 8px; }
.tb-panel-act {
  background: var(--tb-l4); color: var(--tb-card); font-weight: 800;
  padding: 9px 20px; border-radius: 999px; font-size: 1.05rem; text-align: center;
}
.tb-panel-act:hover { background: var(--tb-l3); }
.tb-panel-close {
  background: transparent; color: var(--tb-ink-soft); font-weight: 700;
  padding: 9px 20px; border-radius: 999px; border: 3px solid currentColor; font-size: 1.05rem;
}
.tb-panel-close:hover { color: var(--tb-ink); }

/* ---------- Cambio de nivel y final ---------- */
.tb-splash {
  background: var(--tb-card); color: var(--tb-ink); text-align: center;
  border-radius: 44px 32px 40px 34px; max-width: 820px; width: 100%;
  padding: clamp(28px,5vw,64px); box-shadow: 0 16px 0 var(--tb-shadow);
  border-top: 18px solid var(--tb-lvl); position: relative; overflow: hidden;
}
.tb-splash .tb-big {
  font-size: clamp(2.8rem,8vw,6rem); font-weight: 800; line-height: 1;
  margin: 0 0 8px; color: var(--tb-lvl);
}
#tabu-screen[data-level="2"] .tb-splash .tb-big { color: var(--tb-l2-deep); }
.tb-splash p { font-size: clamp(1.2rem,2.4vw,1.8rem); margin: 0 0 24px; font-weight: 500; }
.tb-splash .tb-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
/* The ghost button is a pale wash meant for the dark backdrop; on the
   splash card's white paper it was white on white and read as missing. */
.tb-splash .tb-btn-prev { background: var(--tb-l4); color: var(--tb-card); }
.tb-splash .tb-btn-prev:hover { background: var(--tb-l4-deep); }
/* The folk rosette from Sandra's references, sitting behind the words. */
.tb-rosette {
  position: absolute; right: -34px; top: -34px;
  width: clamp(130px,19vw,210px); height: auto; opacity: .5; pointer-events: none;
}
.tb-rosette .tb-pt0 { fill: var(--tb-l3); }
.tb-rosette .tb-pt1 { fill: var(--tb-l2); }
.tb-rosette .tb-pt2 { fill: var(--tb-l1); }
.tb-rosette .tb-pt3 { fill: var(--tb-l4); }
.tb-rosette .tb-pd0 { fill: var(--tb-w2); }
.tb-rosette .tb-pd1 { fill: var(--tb-card); }
.tb-rosette .tb-pd2 { fill: var(--tb-w4); }
.tb-rosette .tb-pc  { fill: var(--tb-sun); }
.tb-rosette .tb-pc2 { fill: var(--tb-l3); }
.tb-pop { animation: tb-pop .35s cubic-bezier(.3,1.5,.6,1); }
@keyframes tb-pop { from { transform: scale(.92); opacity: .3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tb-pop { animation: none; } .tb-bar i { transition: none; } }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 860px) {
  .tb-hint { display: none; }
  .tb-tool .tb-lbl { display: none; }
  .tb-progress span { display: none; }
  .tb-controls { gap: 8px; }
  .tb-btn-next { padding: 9px 30px; }
  .tb-btn-prev, .tb-btn-skip { padding: 8px 16px; }
}
/* On a phone the whole round has to fit without scrolling, so the card
   gives up its padding before the controls give up their size: a thumb
   needs the buttons more than the word needs the air. */
@media (max-width: 640px) {
  .tb-screen { min-height: 0; }
  #tb-game { padding: 10px 10px 14px; }
  .tb-topbar { gap: 7px; }
  .tb-level-pill, .tb-score { font-size: 1rem; padding: 4px 13px; }
  .tb-stage { padding: 10px 0; }
  .tb-card { border-radius: 30px 22px 28px 24px; }
  .tb-card-top { padding: 12px 14px 22px; }
  .tb-target { font-size: clamp(2.3rem,12vw,3.4rem); }
  .tb-card.tb-has-tense .tb-target { font-size: clamp(2rem,10vw,2.9rem); }
  .tb-forbidden-wrap { padding: 14px 12px 18px; }
  .tb-forbidden { gap: 7px; }
  .tb-forbidden li { font-size: clamp(1rem,4.6vw,1.35rem); padding: 3px 13px; border-width: 2px; }
  .tb-forbidden li::before { border-width: 3px; }
  .tb-forbidden-label { font-size: 1rem; margin-bottom: 9px; }
  .tb-timer-main { padding: 5px 14px 5px 9px; }
  .tb-timer-main svg { width: 22px; height: 22px; }
  .tb-timer-act { display: none; }
  .tb-timer-reset { width: 38px; height: 38px; }
  .tb-jumps { grid-template-columns: 1fr 1fr; }
  .tb-panel-card { border-radius: 26px 20px 24px 22px; }
}

/* ---------- The signed-out and student gates ---------- */
.tb-gate {
  background: var(--tb-card); color: var(--tb-ink); text-align: center;
  border-radius: 40px 28px 36px 30px; max-width: 680px; width: 100%;
  padding: clamp(28px,4vw,52px); margin: auto;
  box-shadow: 0 14px 0 var(--tb-shadow-lo); position: relative; overflow: hidden;
}
.tb-gate h2 { font-size: clamp(1.6rem,3vw,2.3rem); font-weight: 800; margin: 10px 0 10px; }
.tb-gate p { font-size: clamp(1rem,1.7vw,1.18rem); line-height: 1.5; color: var(--tb-ink-soft); margin: 0 0 8px; }
.tb-gate-what {
  text-align: left; margin: 18px auto 22px; max-width: 480px;
  display: grid; gap: 8px; list-style: none; padding: 0;
}
.tb-gate-what li {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  font-size: clamp(.98rem,1.6vw,1.1rem); color: var(--tb-ink); font-weight: 500;
}
.tb-gate-what li::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--tb-l3); margin-top: .42em;
}
.tb-gate-what li:nth-child(1)::before { background: var(--tb-l1); }
.tb-gate-what li:nth-child(2)::before { background: var(--tb-l2); }
.tb-gate-what li:nth-child(4)::before { background: var(--tb-l4); }
.tb-gate-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Mis palabras (js/tabu-custom.js) ----------
   The editor sits over the whole game screen rather than inside a
   pane, so it can be opened from the intro and from the middle of a
   round without either of them losing their place. */
.tbc-wrap {
  position: fixed; inset: 0; z-index: 70;
  background: var(--tb-veil);
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(10px,2.5vw,30px); overflow-y: auto;
}
.tbc-sheet {
  background: var(--tb-card); color: var(--tb-ink);
  border-radius: 38px 26px 34px 28px; width: 100%; max-width: 900px;
  padding: clamp(18px,2.6vw,32px); box-shadow: 0 14px 0 var(--tb-shadow);
  margin: auto;
}
.tbc-head { display: flex; align-items: center; gap: 14px; }
.tbc-head h3 { margin: 0; flex: 1; font-weight: 800; font-size: clamp(1.3rem,2.4vw,1.9rem); }
.tbc-x {
  background: var(--tb-l3-wash); color: var(--tb-i0); font-weight: 800;
  width: 40px; height: 40px; border-radius: 52% 48% 46% 54% / 50% 52% 48% 50%;
  flex: none; font-size: 1.1rem;
}
.tbc-x:hover { background: var(--tb-l3); color: var(--tb-card); }
.tbc-lead { color: var(--tb-ink-soft); margin: 8px 0 16px; line-height: 1.5; font-size: 1.02rem; }
.tbc-note { color: var(--tb-ink-soft); margin: 8px 0 0; line-height: 1.45; font-size: .92rem; }
.tbc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tbc-sep { flex: 1; min-width: 0; }
.tbc-lab { font-weight: 700; font-size: .86rem; color: var(--tb-ink-soft); }
.tbc-sel, .tbc-in {
  font: inherit; color: var(--tb-ink); background: var(--tb-card);
  border: 3px solid var(--tb-l4-wash); border-radius: 14px; padding: 6px 12px;
}
.tbc-sel { font-weight: 700; border-radius: 999px; padding: 5px 12px; }
.tbc-in { width: 100%; font-weight: 600; }
.tbc-in:focus-visible, .tbc-sel:focus-visible { outline: 4px solid var(--tb-sun); outline-offset: 2px; border-color: var(--tb-l4); }
.tbc-btn {
  background: var(--tb-l4); color: var(--tb-card); font-weight: 800;
  padding: 8px 18px; border-radius: 999px; font-size: 1rem;
}
.tbc-btn:hover { background: var(--tb-l3); }
.tbc-play { background: var(--tb-l1); }
.tbc-play:hover { background: var(--tb-l1-deep); }
.tbc-ghost { background: transparent; color: var(--tb-ink-soft); border: 3px solid currentColor; padding: 5px 15px; }
.tbc-ghost:hover { background: transparent; color: var(--tb-ink); }
.tbc-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.tbc-row {
  display: grid; gap: 8px 12px; align-items: end;
  grid-template-columns: minmax(0,1fr) minmax(0,1.6fr) auto;
  background: var(--tb-w2); border-radius: 20px 14px 18px 16px; padding: 10px 12px;
}
.tbc-row:nth-child(4n+2) { background: var(--tb-w3); }
.tbc-row:nth-child(4n+3) { background: var(--tb-w4); }
.tbc-row:nth-child(4n)   { background: var(--tb-w5); }
.tbc-f { display: grid; gap: 3px; min-width: 0; }
.tbc-acts { display: flex; gap: 6px; }
.tbc-mini {
  background: var(--tb-card); color: var(--tb-ink-soft); font-weight: 700;
  border: 3px solid var(--tb-l4-wash); border-radius: 999px; padding: 5px 12px; font-size: .9rem;
}
.tbc-mini:hover { color: var(--tb-ink); border-color: var(--tb-l4); }
.tbc-empty { color: var(--tb-ink-soft); margin: 14px 0 0; }
.tbc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.tbc-said { color: var(--tb-i3); font-weight: 700; font-size: .95rem; }
@media (max-width: 720px) {
  .tbc-row { grid-template-columns: minmax(0,1fr) auto; }
  .tbc-f-wide { grid-column: 1 / -1; }
  .tbc-sheet { border-radius: 26px 20px 24px 22px; }
  .tbc-sep { display: none; }
}

/* A card with no forbidden words — a teacher's own, left blank. It keeps
   the block so the card is still a card, but says so plainly. */
.tb-forbidden-none .tb-forbidden-label { margin: 0; opacity: .55; font-weight: 700; }

/* The wordmark and its tagline. The tagline wraps under the badge on a
   narrow screen rather than squeezing it. */
.tb-logo { flex-wrap: wrap; }
.tb-logo-tag {
  color: var(--tb-ink-soft); font-weight: 600; line-height: 1.3;
  font-size: clamp(.88rem,1.4vw,1.06rem);
}
.tb-gate .tb-logo { justify-content: center; }
.tb-gate .tb-logo-tag { flex-basis: 100%; }
