/* ══════════════════════════════════════════════════════════════
   COMPLETE THE TEXT — builds on atividades.css and puzzles.css
══════════════════════════════════════════════════════════════ */

/* ─── Theme card preview (navy panel) ─── */
.ct-preview rect {
  fill: rgba(238, 242, 249, 0.2);
  transition: fill .3s ease, stroke .3s ease;
}

.ct-preview rect.title { fill: rgba(238, 242, 249, 0.55); }
.ct-preview rect.page  { fill: rgba(238, 242, 249, 0.07); }

.ct-preview rect.gap {
  fill: #062559;
  stroke: rgba(238, 242, 249, 0.5);
  stroke-width: .8;
}

.ct-preview rect.gap.won   { fill: var(--pz-green); stroke: var(--pz-green); }
.ct-preview rect.gap.lost  { fill: var(--rose); stroke: var(--rose); }
.ct-preview rect.gap.shown { fill: #e3b53d; stroke: #e3b53d; }
.pz-theme-card:hover .ct-preview rect:not(.title):not(.page):not(.gap) { fill: rgba(238, 242, 249, 0.3); }

/* ─── Layout: text on the left, word bank on the right ─── */
.pz-main.ct-main {
  grid-template-columns: minmax(0, 1.3fr) clamp(320px, 30vw, 440px);
}

/* ─── Text ─── */
.ct-text {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: 32px clamp(22px, 3.5vw, 52px) 40px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  animation: pzBoardIn .5s cubic-bezier(0.22, 1, 0.36, 1) .05s both;
}

.ct-text::-webkit-scrollbar       { width: 6px; }
.ct-text::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.ct-text-inner {
  max-width: 72ch;
  margin: 0 auto;
}

.ct-text-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-bottom: 10px;
}

.ct-kind {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
}

.ct-meta {
  font-size: .8rem;
  color: var(--mute);
}

.ac-app .ct-title {
  margin-bottom: 20px;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 2.3vw, 2.15rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--navy);
}

/* Grammar focus: the structure the gaps practise, with the rule on demand */
.ct-focus {
  margin: -6px 0 22px;
  background: var(--pz-paper);
  border-left: 3px solid var(--red);
  border-radius: 0 12px 12px 0;
}

.ct-focus summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 11px 16px;
  font-size: .95rem;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}

.ct-focus summary::-webkit-details-marker { display: none; }

.ct-focus-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--mute);
}

.ct-focus-name { font-weight: 700; }

.ct-focus-toggle {
  margin-left: auto;
  font-size: .82rem;
  font-weight: 700;
  color: var(--navy-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ct-focus-toggle::after { content: 'Show the rule'; }
.ct-focus[open] .ct-focus-toggle::after { content: 'Hide the rule'; }
.ct-focus summary:hover .ct-focus-toggle { color: var(--red); }

.ct-focus-rule {
  padding: 0 16px 13px;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.ct-p {
  margin: 0 0 1.1em;
  font-size: 1.06rem;
  line-height: 2.15;
  color: var(--ink);
}

.ct-p:last-child { margin-bottom: 0; }

/* ─── Gaps ─── */
.ct-gap {
  display: inline-block;
  height: 1.75em;
  margin: 0 .08em;
  padding: 0 .4em;
  font-family: var(--font-sans);
  font-size: 1em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  vertical-align: baseline;
  color: var(--navy);
  background: var(--pz-paper);
  border: 0;
  border-bottom: 2px solid var(--line-heavy);
  border-radius: 7px 7px 3px 3px;
  outline: none;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease;
}

.ct-gap::placeholder {
  font-size: .72em;
  font-weight: 800;
  color: var(--mute);
  opacity: .8;
}

.ct-gap:hover:not([readonly]) { background: #e3e9f4; }

.ct-gap:focus {
  background: var(--white);
  border-bottom-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-35);
}

.ct-gap:focus::placeholder { color: transparent; }

.ct-gap.is-warn {
  background: #fff6dc;
  border-bottom: 2px dashed #d39a18;
}

.ct-gap.is-wrong {
  color: var(--red);
  background: #fbe9e9;
  border-bottom-color: var(--red);
}

.ct-gap.is-ok {
  color: var(--pz-green-dark);
  background: #e6f5ed;
  border-bottom-color: var(--pz-green);
  cursor: default;
}

.ct-gap.is-shown {
  color: #7a5a06;
  background: #fff0c2;
  border-bottom-color: #e3b53d;
  cursor: default;
}

.ct-gap[readonly]:focus { box-shadow: none; }

.ct-gap.is-pop   { animation: ctPop .45s var(--spring); }
.ct-gap.is-shake { animation: ctShake .45s ease; }

@keyframes ctPop {
  40% { transform: scale(1.12); }
}

@keyframes ctShake {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ─── Side panel ─── */
.ct-side {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  animation: qFadeIn .55s cubic-bezier(0.22, 1, 0.36, 1) .15s both;
}

.ct-score {
  flex-shrink: 0;
  padding: 14px 18px 14px;
  background: var(--off-white);
  border-bottom: 1px solid var(--line);
}

.ct-score-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--navy);
}

.ct-score-num {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
}

.ct-score-of {
  font-size: 1rem;
  font-weight: 700;
  color: var(--mute);
}

.ct-score-label {
  margin-left: auto;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--mute);
}

.ct-progress {
  height: 6px;
  margin-top: 10px;
  background: rgba(var(--navy-rgb), .1);
  border-radius: 3px;
  overflow: hidden;
}

.ct-progress i {
  display: block;
  height: 100%;
  background: var(--pz-green);
  border-radius: 3px;
  transition: width .5s cubic-bezier(0.22, 1, 0.36, 1);
}

.ct-bank-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.ct-bank-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  margin-bottom: 12px;
}

.ct-bank-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--red);
}

.ct-bank-info {
  font-size: .76rem;
  color: var(--mute);
}

.ct-bank {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ct-chip {
  padding: 7px 12px;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
  background: var(--pz-paper);
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgba(3, 45, 111, 0.06), inset 0 -3px 0 rgba(3, 45, 111, 0.16);
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.ct-chip.is-used,
.ct-chip.is-done {
  color: var(--mute);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.ct-chip.is-done {
  opacity: .55;
  text-decoration-color: var(--pz-green);
}

.ct-help {
  margin-top: 16px;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--mute);
}

.ct-help b { color: var(--ink-soft); }

.ct-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--line);
}

/* Keeps the main button clear of the floating WhatsApp button */
@media (min-width: 901px) {
  .ct-actions { padding-right: 86px; }
}

.ct-actions .pz-tool:disabled {
  opacity: .5;
  cursor: default;
  color: var(--mute);
  background: var(--white);
  border-color: var(--line-strong);
}

.ct-btn {
  margin-left: auto;
  padding: 11px 20px;
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--white);
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 10px;
  box-shadow: 0 10px 22px -8px rgba(166, 4, 4, 0.55);
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}

.ct-btn:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.ct-btn:active:not(:disabled) { transform: scale(0.96); }

.ct-btn:disabled {
  cursor: default;
  opacity: 1;
  background: var(--pz-green);
  border-color: var(--pz-green);
  box-shadow: none;
}

.ct-side .pz-toast { bottom: 76px; }

/* ─── Stacked layout (tablets and phones) ───
   The panel dissolves: the word bank sticks to the top while you type,
   and the buttons come after the text */
@media (max-width: 900px) {
  .ct-text {
    order: 1;
    overflow: visible;
    padding: 24px 20px 26px;
  }

  .ct-side { display: contents; overflow: visible; }
  .ct-score, .ct-help { display: none; }

  .ct-bank-wrap {
    order: 0;
    position: sticky;
    top: 8px;
    z-index: 20;
    flex: none;
    padding: 10px 12px;
    overflow: visible;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 26px -16px rgba(var(--navy-rgb), .5);
  }

  .ct-bank-head { margin-bottom: 8px; }

  /* One scrollable row, with the words still to use first */
  .ct-bank {
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0 -12px;
    padding: 0 12px 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
  }

  .ct-bank::-webkit-scrollbar { display: none; }
  .ct-chip { flex-shrink: 0; padding: 6px 10px; font-size: .9rem; white-space: nowrap; }
  .ct-chip.is-used, .ct-chip.is-done { order: 1; }

  .ct-actions {
    order: 2;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .ct-side .pz-toast {
    position: fixed;
    bottom: 22px;
    z-index: 60;
  }
}

@media (max-width: 600px) {
  .ct-text { padding: 20px 16px 22px; }
  .ct-p { font-size: 1rem; line-height: 2.1; }
  .ct-focus summary { padding: 10px 12px; }
  .ct-focus-rule { padding: 0 12px 12px; }
  .ct-actions .pz-tool { flex: 1; }
  .ct-btn { flex: 1.3; padding: 11px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ct-gap.is-pop,
  .ct-gap.is-shake { animation: none; }
}
