/* Transformer lesson. All rules scoped under .tf-* */
.tf-sc { width: 100%; display: flex; flex-direction: column; gap: 10px; }

/* the sentence */
.tf-sent { display: flex; flex-wrap: wrap; gap: 8px 7px; justify-content: center; padding: 6px 0; }
.tf-w {
  display: inline-flex; align-items: center; justify-content: center; padding: 6px 11px; min-height: 44px; border-radius: 12px;
  font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 2px solid var(--line); box-shadow: 0 4px 0 #070a14; transition: border-color .2s, background .2s, color .2s, opacity .3s;
}
button.tf-w:disabled { cursor: default; }
.tf-w.next { border-color: var(--violet-bright); background: rgba(123,92,253,.16); animation: tfPulse 1.2s ease-in-out 3; }
@keyframes tfPulse { 50% { box-shadow: 0 4px 0 #070a14, 0 0 0 4px rgba(169,155,255,.22); } }
.tf-w.read { opacity: .45; }
.tf-w.hot { border-color: var(--gold); color: var(--gold); background: rgba(252,192,80,.12); opacity: 1; }
.tf-gap { min-width: 64px; border-style: dashed; border-color: var(--violet-bright); color: var(--gold); }
.tf-gap i { display: inline-block; width: 2px; height: 1em; background: var(--violet-bright); animation: tfCaret 1s steps(2) 6; }
@keyframes tfCaret { 50% { opacity: 0; } }
.tf-gap.set { border-style: solid; animation: tfLand .25s cubic-bezier(.34,1.56,.64,1) both; }
.tf-gap.good { border-color: var(--mint); color: var(--mint); background: rgba(63,214,154,.14); }
.tf-gap.bad { border-color: var(--red); color: #FF9C9C; background: rgba(216,85,85,.14); }
@keyframes tfLand { from { transform: scale(.8); opacity: 0; } }
.tf-w.same { border-color: var(--violet-bright); }

.choices.tf-duo { display: grid; grid-template-columns: 1fr 1fr; }
.choices.tf-duo .choice { justify-content: center; font-family: var(--serif); font-size: 20px; }

/* the old machine's memory */
.tf-mem { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: #06080f; border: 1px solid var(--line); }
.tf-memh { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.tf-memw { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.tf-mc { padding: 3px 9px; border-radius: 8px; background: rgba(169,155,255,.18); color: var(--text); font-family: var(--serif); font-size: 16px; font-weight: 600; transition: opacity .4s; }

/* the transformer's look: arcs from the blank to every word */
.tf-look { position: relative; padding-top: 36px; }
.tf-look .tf-sent { position: relative; z-index: 1; }
.tf-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tf-ln { fill: none; stroke: var(--violet-bright); stroke-width: 1.5; opacity: 0; transition: stroke .4s, stroke-width .4s, opacity .4s; }
.tf-ln.dim { opacity: .35 !important; }
.tf-ln.key { stroke: var(--gold); stroke-width: 4; opacity: 1 !important; }
.tf-gapbtn { position: relative; display: inline-flex; min-width: 64px; min-height: 44px; padding: 0; border-radius: 12px; }
.tf-gapbtn:not(:disabled) .tf-gap { animation: tfPulse 1.2s ease-in-out 4; background: rgba(123,92,253,.16); }
.tf-taplbl { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--violet-bright); }

/* race */
.tf-track { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tf-track .hd { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; color: var(--dim); }
.tf-track .hd b { font-family: var(--mono); color: var(--text); font-size: 12px; text-align: right; }
.tf-cells { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.tf-cells i { display: block; height: 18px; border-radius: 4px; background: var(--raised); transition: background .2s; }
.tf-cells i.on { background: var(--violet-bright); }
.tf-track.done .tf-cells i { background: var(--mint); }
.tf-track.done .hd b { color: var(--mint); }

/* order */
.tf-order { display: flex; flex-direction: column; gap: 12px; align-items: center; padding-top: 8px; }
.tf-order .r { display: flex; gap: 8px; }

/* the bill */
.tf-grid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tf-grid canvas { border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.tf-grid .cap { font-family: var(--mono); font-size: 13px; color: var(--dim); }

.tf-cap { text-align: center; font-size: 13px; color: var(--dim); }

/* writing */
.tf-chat { display: flex; flex-direction: column; gap: 10px; }
.tf-me { align-self: flex-end; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--violet-deep); color: #fff; font-size: 16px; }
.tf-bot { align-self: flex-start; min-height: 46px; min-width: 60%; display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface); border: 1px solid var(--line); font-family: var(--serif); font-size: 19px; }
.tf-rw { animation: tfLand .25s cubic-bezier(.34,1.56,.64,1) both; }

/* a photo as a row of squares */
.tf-photo { width: 208px; height: 208px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; transition: gap .4s; }
.tf-photo.cut { gap: 5px; }
.tf-tile { display: block; background-size: 300% 300%; border-radius: 3px; background-color: var(--surface); }
.tf-photo .tf-tile { width: 100%; height: 100%; }
.tf-row { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.tf-row .tf-tile { aspect-ratio: 1; transform-origin: top left; }

@media (max-height: 700px) {
  .tf-w { font-size: 17px; padding: 4px 9px; }
  .tf-sent { gap: 6px 5px; }
  .tf-look { padding-top: 30px; }
  .tf-photo { width: 170px; height: 170px; }
  .tf-grid canvas { width: 170px !important; height: 170px !important; }
  .tf-cells i { height: 14px; }
}
