/* ============================================================
   TFM Line Writing (Town Square)
   Built by js/tfm-line-writing.js inside the Elementor container
   ".tfm-lw-inline" (the script adds ".tfm-lw").
   Reference: docs/mocks/line-writing-mock.html
   Screens: setup, write (looks Sheet / Focus / Chalkboard), done
   (certificate card), verify.
   Colours only from the area variables (body.tfm-area-square). The paper
   and the chalkboard are fixed materials and keep their own colours.
   The theme styles <button> and <label> globally, so colours, backgrounds
   and borders of the tool's buttons are secured with !important.
   ============================================================ */

.tfm-lw {
  --lw-accent: var(--area-accent, #40d9b0);
  --lw-soft: var(--area-accent-soft, #80e8cc);
  --lw-glow: var(--area-accent-glow, rgba(64, 217, 176, .35));
  --lw-ink: var(--ink, #f6f1ea);
  --lw-text: var(--body-text, #e4ddf0);
  --lw-muted: var(--muted, #b6afc7);
  --lw-line: color-mix(in srgb, var(--lw-accent) 22%, transparent);
  --lw-card: rgba(30, 22, 52, .72);
  --lw-panel: #120f22;
  --lw-field: rgba(6, 8, 16, .55);
  --lw-warn: #ffb3c4;
  --lw-on-accent: #0b1a16;
  --lw-paper: #f3ece0;
  --lw-paper-ink: #2a2238;
  --lw-paper-red: #cc3355;
  position: relative;
  width: 100%;
  color: var(--lw-text);
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
.tfm-lw *,
.tfm-lw *::before,
.tfm-lw *::after {
  box-sizing: border-box;
}
/* Elementor containers are flex columns: keep children from growing wider. */
.tfm-lw > *,
.tfm-lw > .e-con-inner > * {
  min-width: 0;
}
.tfm-lw button,
.tfm-lw input,
.tfm-lw textarea,
.tfm-lw label {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.3;
  box-shadow: none;
  min-height: 0;
}
.tfm-lw button {
  cursor: pointer;
}
.tfm-lw [hidden] {
  display: none !important;
}
.tfm-lw :focus-visible {
  outline: 2px solid var(--lw-soft);
  outline-offset: 2px;
}
.tfm-lw a {
  color: var(--lw-soft);
}

/* ---- card around every screen ---- */
.tfm-lw .lw-card {
  position: relative;
  padding: 28px;
  border-radius: 16px;
  background: var(--lw-card);
  border: 1px solid var(--lw-line);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .9);
}
.tfm-lw .lw-label {
  display: block;
  margin: 0 0 8px;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--lw-soft);
}
.tfm-lw .lw-hint {
  font-size: .78rem;
  color: var(--lw-muted);
}

/* ---- buttons ---- */
.tfm-lw .lw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--lw-accent) 45%, transparent) !important;
  background: color-mix(in srgb, var(--lw-accent) 10%, transparent) !important;
  color: var(--lw-soft) !important;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.tfm-lw .lw-btn:hover {
  background: color-mix(in srgb, var(--lw-accent) 22%, transparent) !important;
  border-color: var(--lw-accent) !important;
}
.tfm-lw .lw-btn.is-solid {
  background: var(--lw-accent) !important;
  border-color: var(--lw-accent) !important;
  color: var(--lw-on-accent) !important;
  box-shadow: 0 0 30px -8px var(--lw-glow);
}
.tfm-lw .lw-btn.is-solid:hover {
  background: var(--lw-soft) !important;
}
.tfm-lw .lw-btn.is-quiet {
  border-color: rgba(255, 255, 255, .14) !important;
  background: transparent !important;
  color: var(--lw-muted) !important;
}
.tfm-lw .lw-btn[disabled] {
  opacity: .5;
  cursor: wait;
}

/* =================== setup =================== */
.tfm-lw .lw-line {
  display: block;
  width: 100%;
  min-height: 84px;
  resize: vertical;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--lw-line) !important;
  background: var(--lw-field) !important;
  color: var(--lw-ink) !important;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.45rem;
  font-style: italic;
  line-height: 1.35;
}
.tfm-lw .lw-line:focus {
  outline: none;
  border-color: var(--lw-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lw-accent) 18%, transparent);
}
.tfm-lw .lw-fixed {
  margin: 0;
  padding: 14px 18px;
  border-left: 3px solid var(--lw-accent);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--lw-ink);
}
.tfm-lw .lw-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.tfm-lw .lw-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 26px;
}
.tfm-lw .lw-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--lw-line);
  background: rgba(6, 8, 16, .45);
}
.tfm-lw .lw-stepper button {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 0 !important;
  background: color-mix(in srgb, var(--lw-accent) 12%, transparent) !important;
  color: var(--lw-soft) !important;
  font-size: 1.2rem;
}
.tfm-lw .lw-stepper input {
  width: 84px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 300;
  color: var(--lw-ink) !important;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.tfm-lw .lw-stepper input::-webkit-outer-spin-button,
.tfm-lw .lw-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tfm-lw .lw-stepper input:focus {
  outline: none;
}
.tfm-lw .lw-stepper.is-fixed button {
  display: none;
}
.tfm-lw .lw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.tfm-lw .lw-chip {
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  background: transparent !important;
  color: var(--lw-muted) !important;
  font-size: .8rem;
}
.tfm-lw .lw-chip[aria-pressed="true"] {
  border-color: var(--lw-accent) !important;
  background: color-mix(in srgb, var(--lw-accent) 16%, transparent) !important;
  color: var(--lw-ink) !important;
}
.tfm-lw .lw-modes {
  display: grid;
  gap: 8px;
}
.tfm-lw .lw-mode {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .1) !important;
  background: rgba(6, 8, 16, .35) !important;
  color: var(--lw-text) !important;
}
.tfm-lw .lw-mode b {
  display: block;
  font-weight: 500;
  color: var(--lw-ink);
}
.tfm-lw .lw-mode small {
  font-size: .78rem;
  color: var(--lw-muted);
}
.tfm-lw .lw-mode[aria-pressed="true"] {
  border-color: var(--lw-accent) !important;
  background: color-mix(in srgb, var(--lw-accent) 12%, transparent) !important;
  box-shadow: inset 3px 0 0 var(--lw-accent);
}
.tfm-lw .lw-more {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.tfm-lw .lw-more summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--lw-soft);
}
.tfm-lw .lw-more summary::-webkit-details-marker {
  display: none;
}
.tfm-lw .lw-more summary::before {
  content: '+';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--lw-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}
.tfm-lw .lw-more[open] summary::before {
  content: '\2212';
}
.tfm-lw .lw-rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.tfm-lw .lw-rule:last-child {
  border-bottom: 0;
}
.tfm-lw .lw-rule small {
  display: block;
  font-size: .76rem;
  color: var(--lw-muted);
}
.tfm-lw .lw-rule .lw-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tfm-lw .lw-mini {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  overflow: hidden;
}
.tfm-lw .lw-mini button {
  padding: 4px 10px;
  border: 0 !important;
  background: transparent !important;
  color: var(--lw-muted) !important;
  font-size: .78rem;
}
.tfm-lw .lw-mini button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--lw-accent) 22%, transparent) !important;
  color: var(--lw-ink) !important;
}
.tfm-lw .lw-switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16) !important;
  background: rgba(255, 255, 255, .06) !important;
  transition: background .2s ease;
}
.tfm-lw .lw-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lw-muted);
  transition: transform .2s ease, background .2s ease;
}
.tfm-lw .lw-switch[aria-checked="true"] {
  border-color: var(--lw-accent) !important;
  background: color-mix(in srgb, var(--lw-accent) 35%, transparent) !important;
}
.tfm-lw .lw-switch[aria-checked="true"]::after {
  transform: translateX(20px);
  background: var(--lw-ink);
}
.tfm-lw .lw-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}
.tfm-lw .lw-error {
  color: var(--lw-warn);
}

/* =================== writing: bar =================== */
.tfm-lw .lw-wbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 22px;
}
.tfm-lw .lw-wcount {
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  color: var(--lw-ink);
  font-variant-numeric: tabular-nums;
}
.tfm-lw .lw-wcount small {
  font-size: 1rem;
  color: var(--lw-muted);
}
.tfm-lw .lw-wprog {
  flex: 1;
  min-width: 140px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.tfm-lw .lw-wprog i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--lw-accent), var(--lw-soft));
  box-shadow: 0 0 12px var(--lw-glow);
  transition: width .5s ease;
}
.tfm-lw .lw-wtools {
  position: relative;
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.tfm-lw .lw-ctl {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14) !important;
  background: rgba(6, 8, 16, .4) !important;
  color: var(--lw-muted) !important;
  font-size: .74rem;
  letter-spacing: .08em;
}
.tfm-lw .lw-ctl:hover,
.tfm-lw .lw-ctl[aria-expanded="true"],
.tfm-lw .lw-ctl[aria-pressed="true"] {
  border-color: var(--lw-accent) !important;
  color: var(--lw-ink) !important;
}
.tfm-lw .lw-looks {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 10;
  width: 300px;
  max-width: calc(100vw - 40px);
  padding: 16px;
  border-radius: 14px;
  background: var(--lw-panel);
  border: 1px solid color-mix(in srgb, var(--lw-accent) 40%, transparent);
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .9);
}
.tfm-lw .lw-looks .lw-label {
  font-size: .6rem;
}
.tfm-lw .lw-looks-list {
  display: grid;
  gap: 6px;
}
.tfm-lw .lw-look {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1) !important;
  background: transparent !important;
  color: var(--lw-ink) !important;
  font-size: .86rem;
}
.tfm-lw .lw-look small {
  display: block;
  font-size: .72rem;
  color: var(--lw-muted);
}
.tfm-lw .lw-look[aria-pressed="true"] {
  border-color: var(--lw-accent) !important;
  background: color-mix(in srgb, var(--lw-accent) 14%, transparent) !important;
}
.tfm-lw .lw-wstats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: .74rem;
  color: var(--lw-muted);
}
.tfm-lw .lw-wstats b {
  font-weight: 500;
  color: var(--lw-ink);
}
.tfm-lw .lw-chipsline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}
.tfm-lw .lw-chipsline span {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .1);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--lw-muted);
}
.tfm-lw.is-paused .lw-stage {
  opacity: .45;
  filter: blur(2px);
  transition: opacity .3s ease, filter .3s ease;
}

/* =================== writing: line and input =================== */
.tfm-lw .lw-target {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  color: var(--lw-ink);
  transition: opacity .4s ease, filter .4s ease;
}
.tfm-lw .lw-target.is-blind {
  opacity: .5;
  filter: blur(7px);
  user-select: none;
}
.tfm-lw .lw-target-cap {
  display: block;
  margin-bottom: 4px;
  text-align: center;
  font-family: 'Jost', sans-serif;
  font-style: normal;
  font-size: .62rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--lw-muted);
}
/* The input is transparent; the mirror below shows the same text with the
   wrong letters marked. --pad-x/--pad-y keep both exactly on top of each other. */
.tfm-lw .lw-typer {
  position: relative;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  line-height: 1.4;
}
.tfm-lw .lw-typer input,
.tfm-lw .lw-typer .lw-mirror {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 2px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  font: inherit;
  letter-spacing: 0;
  white-space: pre;
  overflow: hidden;
}
.tfm-lw .lw-typer input {
  position: relative;
  z-index: 2;
  color: transparent !important;
  caret-color: var(--lw-accent);
}
.tfm-lw .lw-typer input:focus {
  outline: none;
}
.tfm-lw .lw-typer .lw-mirror {
  position: absolute;
  inset: var(--pad-y, 0) var(--pad-x, 0);
  width: auto;
  z-index: 1;
  pointer-events: none;
  color: inherit;
}
.tfm-lw .lw-mirror .is-bad {
  color: var(--lw-warn);
  text-decoration: underline wavy var(--lw-warn);
  text-underline-offset: 4px;
}
.tfm-lw .lw-mirror .is-ghost {
  opacity: .28;
}
.tfm-lw .lw-feedback {
  min-height: 22px;
  margin: 8px 0 0;
  text-align: center;
  font-size: .82rem;
  color: var(--lw-muted);
  transition: color .2s;
}
.tfm-lw .lw-feedback.is-warn {
  color: var(--lw-warn);
}
.tfm-lw .lw-feedback.is-ok {
  color: var(--lw-soft);
}
@keyframes tfm-lw-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
.tfm-lw .is-shaking {
  animation: tfm-lw-shake .45s ease;
}

/* ---- look: Sheet (school notebook) ---- */
.tfm-lw .lw-sheet {
  position: relative;
  padding: 18px 22px 12px 74px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 58px, rgba(204, 51, 85, .55) 58px 60px, transparent 60px),
    repeating-linear-gradient(var(--lw-paper) 0 38px, rgba(64, 140, 200, .28) 38px 40px),
    var(--lw-paper);
  color: var(--lw-paper-ink);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .2);
  transform: rotate(-.4deg);
}
.tfm-lw .lw-holes {
  position: absolute;
  left: 18px;
  top: 26px;
  bottom: 26px;
  width: 14px;
  background: radial-gradient(circle, #0a0d1a 5px, transparent 6px) 0 0 / 14px 70px repeat-y;
  opacity: .75;
}
.tfm-lw .lw-sheet .lw-target {
  margin-bottom: 18px;
  color: var(--lw-paper-ink);
}
.tfm-lw .lw-sheet .lw-target-cap {
  color: rgba(42, 34, 56, .5);
}
.tfm-lw .lw-written {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tfm-lw .lw-sheet .lw-written {
  max-height: 240px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  -webkit-mask-image: linear-gradient(transparent, #000 45%);
  mask-image: linear-gradient(transparent, #000 45%);
}
.tfm-lw .lw-sheet .lw-written li,
.tfm-lw .lw-sheet .lw-typer {
  position: relative;
  height: 40px;
  line-height: 40px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.4rem;
  color: var(--lw-paper-ink);
}
/* The line number sits in the left margin: the row reaches into the margin
   (negative margin + padding), so long lines can still be cut with "…". */
.tfm-lw .lw-sheet .lw-written li,
.tfm-lw .lw-sheet .lw-typer {
  margin: 0 0 0 -56px;
  padding-left: 56px;
}
.tfm-lw .lw-sheet .lw-typer {
  --pad-x: 0px;
  --pad-y: 0px;
}
.tfm-lw .lw-sheet .lw-typer .lw-mirror {
  left: 56px;
}
.tfm-lw .lw-sheet .lw-written li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tfm-lw .lw-sheet .lw-written li::before,
.tfm-lw .lw-sheet .lw-typer::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  width: 34px;
  text-align: right;
  font-family: 'Jost', sans-serif;
  font-style: normal;
  font-size: .7rem;
  color: rgba(42, 34, 56, .45);
}
.tfm-lw .lw-sheet .lw-typer::before {
  color: var(--lw-paper-red);
  line-height: 40px;
}
.tfm-lw .lw-sheet .lw-typer input,
.tfm-lw .lw-sheet .lw-typer .lw-mirror {
  height: 40px;
  padding: 0;
}
.tfm-lw .lw-sheet .lw-typer input {
  caret-color: var(--lw-paper-red);
}
.tfm-lw .lw-sheet .lw-mirror .is-bad {
  color: var(--lw-paper-red);
  text-decoration-color: var(--lw-paper-red);
}

/* ---- look: Focus (one line, progress ring) ---- */
.tfm-lw .lw-focus {
  padding: 10px 0 6px;
  text-align: center;
}
.tfm-lw .lw-ring {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto 22px;
}
.tfm-lw .lw-ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.tfm-lw .lw-ring circle {
  fill: none;
  stroke-width: 6;
}
.tfm-lw .lw-ring .lw-track {
  stroke: rgba(255, 255, 255, .07);
}
.tfm-lw .lw-ring .lw-arc {
  stroke: var(--lw-accent);
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px var(--lw-glow));
  transition: stroke-dashoffset .6s ease;
}
.tfm-lw .lw-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tfm-lw .lw-ring-num b {
  font-size: 2.6rem;
  font-weight: 300;
  line-height: 1;
  color: var(--lw-ink);
}
.tfm-lw .lw-ring-num small {
  margin-top: 4px;
  font-size: .66rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--lw-muted);
}
.tfm-lw .lw-ring.is-pulse::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--lw-accent);
  animation: tfm-lw-pulse .7s ease-out forwards;
}
@keyframes tfm-lw-pulse {
  from { opacity: .9; transform: scale(.9); }
  to { opacity: 0; transform: scale(1.18); }
}
.tfm-lw .lw-focus .lw-typer {
  --pad-x: 18px;
  --pad-y: 4px;
  max-width: 640px;
  margin: 22px auto 0;
  padding: var(--pad-y) var(--pad-x);
  border-radius: 12px;
  border: 1px solid var(--lw-line);
  background: var(--lw-field);
  color: var(--lw-ink);
  text-align: left;
}
.tfm-lw .lw-focus .lw-typer:focus-within {
  border-color: var(--lw-accent);
  box-shadow: 0 0 30px -10px var(--lw-glow);
}

/* ---- look: Chalkboard ---- */
.tfm-lw .lw-board {
  position: relative;
  min-height: 330px;
  padding: 26px 30px 20px;
  overflow: hidden;
  border-radius: 6px;
  border: 14px solid #5b4330;
  border-bottom-width: 20px;
  background:
    radial-gradient(600px 300px at 30% 20%, rgba(255, 255, 255, .05), transparent 70%),
    radial-gradient(400px 260px at 80% 90%, rgba(255, 255, 255, .04), transparent 70%),
    #1f2b26;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .55), 0 30px 60px -30px rgba(0, 0, 0, .9);
  color: #eef0ea;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  text-shadow: 0 0 1px rgba(255, 255, 255, .6), 0 0 6px rgba(255, 255, 255, .15);
}
.tfm-lw .lw-board .lw-target {
  margin-bottom: 14px;
  text-align: left;
  font-size: 1rem;
  color: rgba(238, 240, 234, .7);
}
.tfm-lw .lw-board .lw-target-cap {
  text-align: left;
  color: rgba(238, 240, 234, .5);
}
.tfm-lw .lw-board .lw-written li {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.75;
  opacity: .82;
}
.tfm-lw .lw-board .lw-written li:nth-child(odd) {
  transform: translateX(2px) rotate(-.25deg);
}
.tfm-lw .lw-board .lw-written li:nth-child(even) {
  transform: translateX(-1px) rotate(.2deg);
}
.tfm-lw .lw-board .lw-typer {
  font-size: 1.35rem;
  color: #fff;
  border-bottom: 1px dashed rgba(255, 255, 255, .35);
}
.tfm-lw .lw-board .lw-typer input {
  caret-color: #fff;
}
.tfm-lw .lw-board .lw-mirror .is-bad {
  color: #ffb0c0;
  text-decoration-color: #ffb0c0;
}
.tfm-lw .lw-wipe {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #1f2b26 30%, #1f2b26 70%, transparent);
  transform: translateX(-110%);
  pointer-events: none;
}
.tfm-lw .lw-wipe.is-go {
  animation: tfm-lw-wipe .9s ease-in-out;
}
@keyframes tfm-lw-wipe {
  to { transform: translateX(110%); }
}
.tfm-lw .lw-boardnote {
  margin: 26px 0 0;
  text-align: center;
  font-size: .74rem;
  color: var(--lw-muted);
}

/* ---- resume dialog ---- */
.tfm-lw .lw-dlg {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 16px;
  background: rgba(6, 8, 16, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.tfm-lw .lw-dlg-box {
  width: 100%;
  max-width: 420px;
  padding: 26px;
  border-radius: 16px;
  background: var(--lw-panel);
  border: 1px solid color-mix(in srgb, var(--lw-accent) 40%, transparent);
  text-align: center;
}
.tfm-lw .lw-dlg h3 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--lw-ink);
}
.tfm-lw .lw-dlg q {
  display: block;
  margin: 12px 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-style: italic;
  color: var(--lw-text);
}
.tfm-lw .lw-dlg .lw-wstats {
  justify-content: center;
}
.tfm-lw .lw-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

/* =================== done =================== */
.tfm-lw .lw-done-head {
  text-align: center;
}
.tfm-lw .lw-done-head h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.3rem;
  font-weight: 600;
  color: var(--lw-ink);
}
.tfm-lw .lw-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px;
  margin: 16px 0 28px;
}
.tfm-lw .lw-stats div {
  text-align: center;
}
.tfm-lw .lw-stats b {
  display: block;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--lw-ink);
}
.tfm-lw .lw-stats small {
  font-size: .64rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--lw-muted);
}
.tfm-lw .lw-done-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 30px;
  align-items: start;
}
.tfm-lw .lw-cert {
  display: block;
  width: 100%;
  max-width: 440px;
  height: auto;
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  border-radius: 14px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .95), 0 0 0 1px color-mix(in srgb, var(--lw-accent) 25%, transparent);
  background: #0d0f20;
}
.tfm-lw .lw-side {
  display: grid;
  gap: 14px;
}
.tfm-lw .lw-name {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--lw-line) !important;
  background: var(--lw-field) !important;
  color: var(--lw-ink) !important;
}
.tfm-lw .lw-name:focus {
  outline: none;
  border-color: var(--lw-accent) !important;
}
.tfm-lw .lw-verified {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--lw-line);
  background: rgba(6, 8, 16, .35);
  font-size: .82rem;
}
.tfm-lw .lw-verified code {
  font-family: ui-monospace, monospace;
  letter-spacing: .1em;
  color: var(--lw-soft);
  background: none;
}
.tfm-lw .lw-verified.is-warn code {
  color: var(--lw-warn);
}

/* =================== verify =================== */
.tfm-lw .lw-verify {
  text-align: center;
}
.tfm-lw .lw-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--lw-accent);
  background: color-mix(in srgb, var(--lw-accent) 14%, transparent);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--lw-soft);
}
.tfm-lw .lw-badge.is-bad {
  border-color: color-mix(in srgb, var(--lw-warn) 60%, transparent);
  background: color-mix(in srgb, var(--lw-warn) 8%, transparent);
  color: var(--lw-warn);
}
.tfm-lw .lw-verify q {
  display: block;
  max-width: 560px;
  margin: 18px auto 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-style: italic;
  color: var(--lw-ink);
}
.tfm-lw .lw-check {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 28px auto 0;
}
.tfm-lw .lw-check input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--lw-line) !important;
  background: var(--lw-field) !important;
  color: var(--lw-ink) !important;
  font-family: ui-monospace, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.tfm-lw .lw-below {
  margin: 18px 0 0;
  text-align: center;
  font-size: .78rem;
  color: var(--lw-muted);
}
.tfm-lw .lw-linkbtn {
  padding: 0;
  border: 0 !important;
  background: none !important;
  color: var(--lw-soft) !important;
  text-decoration: underline;
  font-size: inherit;
}

/* =================== lines of everyone (above the tool) =================== */
.tfm-lw .lw-community {
  margin: 0 0 16px;
  text-align: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.12rem;
  color: var(--lw-muted);
  animation: lwCommunityIn .9s ease both;
}
.tfm-lw .lw-community b {
  font-style: normal;
  font-weight: 600;
  color: var(--lw-soft);
  font-variant-numeric: tabular-nums;
}
.tfm-lw.lw-is-writing .lw-community,
.tfm-lw .lw-is-writing .lw-community {
  display: none;
}
@keyframes lwCommunityIn { from { opacity: 0; } }

/* =================== line task: title and intro in the setup =================== */
.tfm-lw .lw-task {
  margin: 0 0 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--lw-line);
}
.tfm-lw .lw-task h3 {
  margin: 4px 0 6px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--lw-ink);
}
.tfm-lw .lw-task p {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--lw-text);
}
.tfm-lw .lw-copyrules {
  margin-left: auto;
  font-size: .78rem;
}

/* =================== phones =================== */
@media (max-width: 760px) {
  .tfm-lw .lw-card {
    padding: 20px 16px;
  }
  .tfm-lw .lw-cols,
  .tfm-lw .lw-done-grid {
    grid-template-columns: 1fr;
  }
  .tfm-lw .lw-wtools {
    margin-left: 0;
  }
  .tfm-lw .lw-wstats {
    width: 100%;
  }
  .tfm-lw .lw-sheet {
    padding-left: 56px;
    background:
      linear-gradient(90deg, transparent 44px, rgba(204, 51, 85, .55) 44px 46px, transparent 46px),
      repeating-linear-gradient(var(--lw-paper) 0 38px, rgba(64, 140, 200, .28) 38px 40px),
      var(--lw-paper);
  }
  .tfm-lw .lw-holes {
    left: 10px;
  }
  .tfm-lw .lw-sheet .lw-written li,
  .tfm-lw .lw-sheet .lw-typer {
    font-size: 1.15rem;
  }
  .tfm-lw .lw-sheet .lw-written li,
  .tfm-lw .lw-sheet .lw-typer {
    margin-left: -50px;
    padding-left: 50px;
  }
  .tfm-lw .lw-sheet .lw-typer .lw-mirror {
    left: 50px;
  }
  .tfm-lw .lw-sheet .lw-written li::before,
  .tfm-lw .lw-sheet .lw-typer::before {
    width: 30px;
  }
  .tfm-lw .lw-typer {
    font-size: 1.2rem;
  }
  .tfm-lw .lw-board {
    padding: 18px 16px;
    border-width: 10px;
    border-bottom-width: 14px;
  }
  .tfm-lw .lw-board .lw-written li,
  .tfm-lw .lw-board .lw-typer {
    font-size: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tfm-lw .is-shaking,
  .tfm-lw .lw-ring.is-pulse::after,
  .tfm-lw .lw-wipe.is-go {
    animation: none;
  }
}

/* =====================================================================
   v2: presets, rule groups, pressure, fading, distractions, chart
   ===================================================================== */

/* ---- presets ---- */
.tfm-lw .lw-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tfm-lw .lw-preset {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 14px 13px;
  text-align: left; border-radius: 14px !important; min-height: 112px;
  border: 1px solid var(--lw-line) !important; background: var(--lw-field) !important; color: var(--lw-text) !important;
  transition: border-color .2s ease, box-shadow .25s ease, transform .2s ease;
}
.tfm-lw .lw-preset:hover { border-color: color-mix(in srgb, var(--lw-accent) 55%, transparent) !important; transform: translateY(-1px); }
.tfm-lw .lw-preset svg { width: 26px; height: 26px; margin-bottom: 4px; stroke: var(--lw-soft); fill: none; stroke-width: 1.4; opacity: .9; }
.tfm-lw .lw-preset b { font-family: 'Cormorant Garamond', serif; font-size: 1.25rem; font-weight: 600; color: var(--lw-ink); line-height: 1.1; }
.tfm-lw .lw-preset small { font-size: .74rem; color: var(--lw-muted); line-height: 1.35; }
.tfm-lw .lw-preset[aria-pressed="true"] {
  border-color: var(--lw-accent) !important; box-shadow: 0 0 0 1px var(--lw-accent), 0 0 34px -12px var(--lw-glow);
  background: color-mix(in srgb, var(--lw-accent) 9%, var(--lw-field)) !important;
}
.tfm-lw .lw-preset[aria-pressed="true"]::after {
  content: "\2713"; position: absolute; top: 10px; right: 12px; font-size: .8rem; color: var(--lw-on-accent);
  width: 20px; height: 20px; border-radius: 50%; background: var(--lw-accent); display: grid; place-items: center;
}

/* ---- groups (accordion) ---- */
.tfm-lw .lw-groups { display: grid; gap: 8px; margin-top: 10px; }
.tfm-lw .lw-acc { border: 1px solid var(--lw-line); border-radius: 12px; background: var(--lw-field); overflow: hidden; }
.tfm-lw .lw-acc[open] { border-color: color-mix(in srgb, var(--lw-accent) 40%, transparent); }
.tfm-lw .lw-acc > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 50px;
}
.tfm-lw .lw-acc > summary::-webkit-details-marker { display: none; }
.tfm-lw .lw-acc > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--lw-soft); border-bottom: 2px solid var(--lw-soft); transform: rotate(45deg); margin-left: 4px; transition: transform .2s ease; flex: none; }
.tfm-lw .lw-acc[open] > summary::after { transform: rotate(-135deg); }
.tfm-lw .lw-acc-name { font-size: .7rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--lw-soft); min-width: 110px; }
.tfm-lw .lw-acc-sum { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; justify-content: flex-end; }
.tfm-lw .lw-acc-sum span { font-size: .7rem; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--lw-accent) 14%, transparent); color: var(--lw-soft); }
.tfm-lw .lw-acc-sum span.is-none { background: transparent; border: 1px dashed var(--lw-line); color: var(--lw-muted); }
.tfm-lw .lw-acc-body { padding: 2px 14px 14px; }
.tfm-lw .lw-acc-body > .lw-hint { margin: 10px 0 0; }

/* ---- rule cards ---- */
.tfm-lw .lw-rcs { display: flex; flex-wrap: wrap; gap: 8px; }
.tfm-lw .lw-rc {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 10px !important;
  border: 1px solid var(--lw-line) !important; background: transparent !important; color: var(--lw-text) !important; font-size: .86rem;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.tfm-lw .lw-rc:hover { border-color: color-mix(in srgb, var(--lw-accent) 55%, transparent) !important; }
.tfm-lw .lw-rc[aria-pressed="true"] { background: var(--lw-accent) !important; border-color: var(--lw-accent) !important; color: var(--lw-on-accent) !important; font-weight: 500; }
.tfm-lw .lw-rc .lw-val { font-size: .68rem; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.18); }
.tfm-lw .lw-rc[aria-disabled="true"] { opacity: .38; border-style: dashed !important; cursor: not-allowed; }
.tfm-lw .lw-rc .lw-why { font-size: .68rem; font-style: italic; color: var(--lw-muted); }
.tfm-lw .lw-rc-sep { width: 1px; align-self: stretch; background: var(--lw-line); margin: 0 4px; }
.tfm-lw .lw-vals { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.03); font-size: .8rem; color: var(--lw-muted); }
.tfm-lw .lw-vals .lw-mini button { min-width: 44px; }
.tfm-lw .lw-sub { font-size: .66rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--lw-muted); margin: 14px 0 8px; }
.tfm-lw .lw-estimate { font-size: .8rem; color: var(--lw-muted); }
.tfm-lw .lw-estimate b { color: var(--lw-ink); font-weight: 500; }

/* ---- writing: head additions ---- */
.tfm-lw .lw-wcount.is-timeless { font-family: 'Cormorant Garamond', serif; font-size: 2rem; line-height: 1; }
.tfm-lw .lw-wcount.is-timeless small { font-family: 'Jost', sans-serif; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; margin-left: 6px; }
.tfm-lw .lw-vol { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--lw-muted); }
.tfm-lw .lw-vol input { width: 70px; accent-color: var(--lw-accent); }
.tfm-lw .lw-limits { display: flex; gap: 6px; flex-wrap: wrap; }
.tfm-lw .lw-limit { font-size: .72rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--lw-line); color: var(--lw-soft); }
.tfm-lw .lw-limit.is-close { border-color: var(--lw-warn); color: var(--lw-warn); animation: lw-pulse 1.2s ease-in-out infinite; }
.tfm-lw .lw-ctl[disabled] { opacity: .4; cursor: not-allowed; }
@keyframes lw-pulse { 50% { box-shadow: 0 0 0 4px rgba(255,179,196,.12); } }

/* ---- fading: characters that are gone keep their width ---- */
.tfm-lw .lw-gone { color: transparent !important; text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, currentColor 0%, var(--lw-muted)); text-underline-offset: 4px; }
.tfm-lw .lw-sheet .lw-gone { text-decoration-color: rgba(42, 34, 56, .35); }

/* ---- idle countdown ---- */
.tfm-lw .lw-countdown { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--lw-warn); }
.tfm-lw .lw-countdown b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--lw-warn); font-weight: 500; }

/* ---- ratchet: last written line is taken back ---- */
.tfm-lw .lw-written li.is-taken { text-decoration: line-through; opacity: .35; transition: opacity .6s ease; }

/* ---- distractions ---- */
.tfm-lw .lw-stage { position: relative; }
.tfm-lw .lw-dis { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.tfm-lw .lw-dis-word {
  position: absolute; white-space: nowrap; font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 500;
  color: var(--lw-soft); text-shadow: 0 0 18px var(--lw-glow), 0 0 2px rgba(0,0,0,.6);
  opacity: 0; animation: lw-dis 3.6s ease-in-out forwards;
}
/* on the cream paper of the Sheet look: dark turquoise instead of light glow */
.tfm-lw .lw-dis.is-paper .lw-dis-word { color: color-mix(in srgb, var(--lw-accent) 55%, #10302a); text-shadow: 0 0 14px rgba(255, 255, 255, .9); }
@keyframes lw-dis {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.94) rotate(var(--r, 0deg)); filter: blur(4px); }
  22% { opacity: .9; transform: translate(-50%, -50%) scale(1) rotate(var(--r, 0deg)); filter: blur(0); }
  70% { opacity: .9; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04) rotate(var(--r, 0deg)); filter: blur(3px); }
}

/* ---- done: line chart ---- */
.tfm-lw .lw-chart { margin-top: 18px; }
.tfm-lw .lw-chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 10px; border-radius: 12px; background: var(--lw-field); border: 1px solid var(--lw-line); }
.tfm-lw .lw-chart-bars i { flex: 1; min-width: 2px; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--lw-accent) 55%, transparent); }
.tfm-lw .lw-chart-bars i.is-err { background: var(--lw-warn); }
.tfm-lw .lw-chart-legend { display: flex; justify-content: space-between; margin-top: 6px; font-size: .72rem; color: var(--lw-muted); }

/* ---- failed ---- */
.tfm-lw .lw-dlg-box .lw-eyebrow-warn { font-size: .66rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--lw-warn); }

@media (max-width: 760px) {
  .tfm-lw .lw-presets { grid-template-columns: 1fr 1fr; }
  .tfm-lw .lw-preset { min-height: 100px; }
  .tfm-lw .lw-acc > summary { flex-wrap: wrap; }
  .tfm-lw .lw-acc-name { min-width: 0; flex: 1; }
  .tfm-lw .lw-acc-sum { order: 3; flex-basis: 100%; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .tfm-lw .lw-dis-word { animation-name: lw-dis-still; }
  @keyframes lw-dis-still { 0%, 100% { opacity: 0; transform: translate(-50%, -50%); } 25%, 70% { opacity: .9; transform: translate(-50%, -50%); } }
  .tfm-lw .lw-limit.is-close { animation: none; }
}
