/* ==========================================================================
   WIZKET — teach.css · "Teach it" (AI Automation page, #teach)
   Record yourself moving 3 details from an invoice into a sheet; 200 ghost cursors
   then replay your exact path on a canvas grid. js/teach.js sets data-state on .tc
   (idle · rec · saved · auto · done). Paper + sheet keep their own palette.
   Prefix: tc-
   ========================================================================== */
.tc {
  --side: clamp(20px, 6vw, 110px);
  position: relative;
  padding: clamp(90px, 14vh, 160px) var(--side) clamp(70px, 11vh, 130px);
  background: var(--bg);
}
.tc__head { width: min(1180px, 100%); margin: 0 auto clamp(22px, 4vh, 36px); display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 32px; }
.tc__title { margin: 0; font: 400 clamp(2.6rem, min(6vw, 11vh), 6.4rem)/0.9 var(--font-display); text-transform: uppercase; color: var(--text); }
.tc__sub { margin: 0 0 6px; max-width: 32ch; font: 500 clamp(0.95rem, 1.1vw, 1.08rem)/1.45 var(--font-body); color: var(--muted); }
.tc__game { width: min(1180px, 100%); margin: 0 auto; }
.tc__bar { display: flex; align-items: center; gap: 12px 26px; padding: 14px 20px; border: 1px solid var(--line2); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--surface); }
.tc__step { margin-right: auto; font: 600 12px/1 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.tc__rec { display: inline-flex; align-items: center; gap: 8px; font: 700 12px/1 var(--font-body); letter-spacing: 0.16em; color: var(--muted); }
.tc__rec i { width: 10px; height: 10px; border-radius: 50%; background: var(--line2); }
.tc[data-state="rec"] .tc__rec { color: #e5383b; }
.tc[data-state="rec"] .tc__rec i { background: #e5383b; box-shadow: 0 0 10px #e5383b; animation: tc-blink 1s steps(1) infinite; }
@keyframes tc-blink { 50% { opacity: 0.25; } }
.tc__time { font: 600 14px/1 var(--font-body); color: var(--muted); }
.tc__time b { font: 400 24px/1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }

.tc__desk {
  position: relative;
  height: clamp(440px, 62vh, 560px);
  border: 1px solid var(--line2);
  border-radius: 0 0 20px 20px;
  overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--petrol);
  user-select: none;
  -webkit-user-select: none;
}

/* ---- the single task ---- */
.tc-task { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: clamp(28px, 6vw, 90px); padding: 24px; transform-origin: 0 0; }
.tc-inv {
  position: relative;
  width: min(300px, 40%);
  padding: 22px 22px 70px;
  border-radius: 6px;
  background: #fdfdfb;
  color: #22282d;
  box-shadow: 0 30px 50px -26px rgba(0, 0, 0, 0.6);
  rotate: -2deg;
}
.tc-inv p { margin: 0; }
.tc-inv__h { margin-bottom: 18px !important; font: 800 13px/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; }
.tc-inv__h span { color: #8a9399; }
.tc-inv__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #dfe3e6; font: 600 12px/1 var(--font-body); color: #8a9399; }
.tc-inv__lines { position: absolute; left: 22px; right: 22px; bottom: 20px; height: 34px; background: linear-gradient(#e9ecef 2px, transparent 2px) 0 0 / 100% 11px; }
.tc-chip {
  position: relative;
  z-index: 2;
  padding: 7px 11px;
  border-radius: 8px;
  background: #e6f6f8;
  border: 1.5px dashed #2b8a9a;
  color: #12424a;
  font: 700 13.5px/1 var(--font-body);
  cursor: grab;
  touch-action: none;
  transition: box-shadow 0.2s, opacity 0.3s;
}
.tc-chip.is-drag { z-index: 5; cursor: grabbing; border-style: solid; box-shadow: 0 16px 28px -10px rgba(0, 0, 0, 0.45); }
.tc-chip.is-sel { border-style: solid; box-shadow: 0 0 0 3px rgba(43, 138, 154, 0.35); }
.tc-chip.is-used { opacity: 0.3; pointer-events: none; text-decoration: line-through; }
.tc[data-state="idle"] .tc-chip { pointer-events: none; }

.tc-sheet { width: min(380px, 48%); border-radius: 8px; overflow: hidden; background: #fff; color: #1b2125; box-shadow: 0 30px 50px -26px rgba(0, 0, 0, 0.6); }
.tc-sheet__h { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; background: #1f8f4e; color: #fff; font: 700 13px/1 var(--font-body); }
.tc-sheet__h i { width: 14px; height: 14px; border-radius: 3px; background: rgba(255, 255, 255, 0.85); }
.tc-sheet__grid { display: grid; grid-template-columns: 1.3fr 1fr 0.9fr; }
.tc-sheet__grid > span { min-height: 46px; padding: 0 10px; display: flex; align-items: center; border-right: 1px solid #e5e9ee; border-bottom: 1px solid #e5e9ee; font: 600 13px/1.2 var(--font-body); }
.tc-sheet__grid > span:nth-child(3n) { border-right: 0; }
.tc-sheet__k { min-height: 32px !important; background: #f3f5f7; font-size: 11px !important; letter-spacing: 0.12em; text-transform: uppercase; color: #7a848b; }
.tc-cell { transition: background-color 0.25s, box-shadow 0.25s; }
.tc-cell.is-over { background: #e6f6f8; box-shadow: inset 0 0 0 2px #2b8a9a; }
.tc-cell.is-nope { animation: tc-nope 0.4s var(--ease-io); box-shadow: inset 0 0 0 2px #e5383b; }
.tc-cell.is-full { background: #effaf3; color: #14532d; }
.tc-cell.is-full::after { content: "\2713"; margin-left: auto; color: #1f8f4e; font-weight: 800; }
@keyframes tc-nope { 25% { translate: -5px 0; } 50% { translate: 4px 0; } 75% { translate: -2px 0; } }
.tc-sel .tc-cell { box-shadow: inset 0 0 0 1.5px rgba(43, 138, 154, 0.5); }

.tc-grid { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.tc[data-state="auto"] .tc-grid, .tc[data-state="done"] .tc-grid { display: block; }
.tc[data-state="auto"] .tc-task, .tc[data-state="done"] .tc-task { visibility: hidden; }

/* ---- overlays ---- */
.tc-ov {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease-io), visibility 0s 0.4s;
}
.tc[data-state="idle"] [data-tc-ov="idle"],
.tc[data-state="saved"] [data-tc-ov="saved"],
.tc[data-state="done"] [data-tc-ov="done"] { opacity: 1; visibility: visible; transition: opacity 0.4s var(--ease-io); }
.tc-ov p { margin: 0; }
.tc-ov__k { font: 700 11px/1 var(--font-body); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.tc-ov__h { font: 400 clamp(2rem, 4vw, 3.4rem)/0.92 var(--font-display); text-transform: uppercase; color: var(--text); }
.tc-ov__h span:last-child { color: var(--accent); }
.tc-ov__p, .tc-ov__note { max-width: 42ch; font: 500 15px/1.45 var(--font-body); color: var(--muted); }
.tc-ov__note { font-size: 12.5px; }
.tc-hint-touch { display: none; }
@media (hover: none) { .tc-hint-mouse { display: none; } .tc-hint-touch { display: inline; } }
.tc-btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 999px; border: 1px solid var(--line2); font: 700 15px/1 var(--font-body); color: var(--text); transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
.tc-btn--rec { padding: 18px 40px; background: var(--text); color: var(--bg); border-color: var(--text); font-size: 17px; }
.tc-btn--rec i { width: 12px; height: 12px; border-radius: 50%; background: #e5383b; }
.tc-btn--go { padding: 18px 40px; background: var(--accent); color: #fff; border-color: var(--accent); font-size: 17px; }
@media (hover: hover) and (pointer: fine) { .tc-btn--rec:hover { background: var(--accent); border-color: var(--accent); color: #fff; } }

.tc-squiggle { width: 200px; height: 80px; overflow: visible; }
.tc-squiggle path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(253, 95, 7, 0.6)); }
.tc-recipe { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: tc; }
.tc-recipe li { padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line2); font: 600 13px/1 var(--font-body); color: var(--text); counter-increment: tc; }
.tc-recipe li::before { content: counter(tc) "  "; font: 400 11px/1 var(--font-display); color: var(--accent); }
.tc-speed { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line2); }
.tc-speed button { padding: 8px 14px; border-radius: 999px; font: 700 13px/1 var(--font-body); color: var(--muted); }
.tc-speed button.is-on { background: var(--text); color: var(--bg); }

.tc-res { display: grid; gap: 10px; width: min(520px, 100%); }
.tc-res__row { display: grid !important; grid-template-columns: 0.8fr 1.2fr 1fr; align-items: baseline; gap: 10px; padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line2); font: 500 13px/1.2 var(--font-body); color: var(--muted); text-align: left; }
.tc-res__row b { font: 400 22px/1 var(--font-display); text-transform: uppercase; color: var(--text); }
.tc-res__row i { margin-right: 4px; font: 400 26px/1 var(--font-display); font-style: normal; color: var(--text); }
.tc-res__row--ai { border-color: var(--accent); }
.tc-res__row--ai b { color: var(--accent); }
.tc-ov__end { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 18px; margin-top: 4px; }
.tc__say { min-height: 1.5em; margin: 14px 0 0; text-align: center; font: 600 14px/1.4 var(--font-body); color: var(--muted); }

@media (max-width: 760px) {
  .tc__desk { height: 560px; }
  .tc-task { flex-direction: column; gap: 22px; }
  .tc-inv { width: min(300px, 88%); padding-bottom: 54px; }
  .tc-sheet { width: min(360px, 94%); }
  .tc__bar { gap: 8px 14px; padding: 12px 14px; }
  .tc__step { font-size: 10.5px; letter-spacing: 0.1em; }
}
