/* Lab Transformasi Geometri dan Fungsi. Awalan tl-. Warna tahap: asli biru, tahap 1 oranye, tahap 2 hijau, tahap 3 ungu. */
.tl { --tl: #a21caf; --tl-soft: #fae8ff; --c0: #2563eb; --c1: #f97316; --c2: #16a34a; --c3: #9333ea; --ct: #dc2626; }
.tl-wrap { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 37%, 470px); background: #f8fafc; overflow: hidden; }
.tl-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 3px solid var(--line); background: #fff; }
.tl-canvasbox { position: relative; flex: 1; min-height: 0; min-width: 0; overflow: hidden; background: #fff; }
#cv { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#cv.drag { cursor: grabbing; }
#cv.mark { cursor: crosshair; }
.tl-legend { position: absolute; left: 6px; top: 6px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 64px); pointer-events: none; }
.tl-lg { pointer-events: auto; min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 999px; border: 3px solid var(--k); background: rgba(255,255,255,.92); color: var(--ink); font: 800 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tl-lg i { width: 14px; height: 14px; border-radius: 50%; background: var(--k); flex: none; }
.tl-lg[aria-pressed="true"] { background: var(--k); color: #fff; }
.tl-lg[aria-pressed="true"] i { background: #fff; }
.tl-lg.tgt { border-style: dashed; }
.tl-tools { position: absolute; right: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; }
.tl-tb { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: rgba(255,255,255,.94); color: var(--ink); font: 800 22px/1 var(--font); cursor: pointer; padding: 0; box-shadow: 0 2px 6px rgba(15,23,42,.15); }
.tl-tb-t { font-size: 11px; }
.tl-tb:active, .tl-tb:hover { background: var(--tl-soft); }
.tl-tip { position: absolute; left: 6px; right: 58px; bottom: 6px; background: rgba(15,23,42,.86); color: #fff; font: 700 13px/1.35 var(--font); padding: 6px 10px; border-radius: 12px; pointer-events: none; }
.tl-tip[hidden] { display: none; }
.tl-anim { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 2px solid var(--line); background: #fff; flex: none; min-width: 0; }
.tl-pb { min-height: 44px; min-width: 44px; border-radius: 999px; border: 2px solid var(--tl); background: #fff; color: var(--tl); font: 800 15px var(--font); cursor: pointer; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; }
.tl-play { background: var(--tl); color: #fff; padding: 0 14px; }
.tl-pb svg { width: 20px; height: 20px; fill: currentColor; }
.tl-pb.tl-ic svg { fill: none; }
.tl-play .ic-pause { display: none; }
.tl-play.on .ic-pause { display: inline; } .tl-play.on .ic-play { display: none; }
.tl-scrub { flex: 1; min-width: 60px; display: block; }
.tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tl input[type=range] { width: 100%; height: 44px; margin: 0; accent-color: var(--sc, var(--tl)); background: transparent; touch-action: pan-y; cursor: pointer; }
.tl-panel { min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; background: linear-gradient(180deg, #fdf4ff, #f8fafc 40%); }
.tl-view { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tl-view[hidden] { display: none; }
.tl-hud { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.tl-hud:empty { display: none; }
.tl-chip { background: #fff; border: 3px solid var(--c); color: var(--ink); border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: 14px; display: inline-flex; gap: 6px; align-items: baseline; }
.tl-chip b { font-size: 1.2em; font-variant-numeric: tabular-nums; }
.tl-chip i { font-style: normal; }
.tl-chip.on { background: var(--c); color: #fff; }
.tl-qn { font-weight: 800; color: var(--muted); font-size: 14px; }
.tl-turn { text-align: center; font-weight: 800; font-size: 15px; color: var(--c); }
.tl-card { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; min-width: 0; text-align: left; }
.tl-card > h3 { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-card > h3 .hint { font-weight: 600; font-size: 12px; color: var(--muted); }
.tl-card p { margin: 4px 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.tl-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-sb { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: 800 14px var(--font); cursor: pointer; }
.tl-sb[aria-pressed="true"] { background: var(--tl); border-color: var(--tl); color: #fff; }
.tl-sb:disabled { opacity: .45; cursor: default; }
.tl-sb.on-sc[aria-pressed="true"] { background: var(--sc); border-color: var(--sc); }
.tl-fxrow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.tl-fxrow label { font-weight: 800; color: var(--ink); white-space: nowrap; }
#fx { flex: 1; min-width: 0; min-height: 44px; font: 700 18px var(--font); padding: 0 12px; border: 2px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; box-sizing: border-box; }
#fx.bad { border-color: var(--bad); background: #fff1f2; }
#fx.good { border-color: var(--ok); }
.tl-msg { min-height: 1.5em; font-size: 14px; font-weight: 700; margin: 4px 0 0 !important; }
.tl-msg.ok { color: var(--ok); } .tl-msg.bad { color: var(--bad); }
.tl-pretty { font: 700 20px/1.4 var(--font); color: var(--ink); overflow-wrap: anywhere; }
.tl-keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.tl-keys[hidden] { display: none; }
.tl-key { min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: #f1f5f9; color: var(--ink); font: 800 16px var(--font); cursor: pointer; padding: 0; }
.tl-key.fn { background: #ede9fe; color: #5b21b6; font-size: 14px; }
.tl-key.op { background: #e0f2fe; color: #075985; }
.tl-key.del { background: #ffe4e6; color: var(--bad); }
.tl-key:active { transform: translateY(1px); background: var(--tl-soft); }
.tl-stage { border-left: 8px solid var(--sc); }
.tl-sh { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.tl-sh b { flex: 1; font-size: 16px; color: var(--sc); }
.tl-icb { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; padding: 0; display: inline-grid; place-items: center; font: 800 20px var(--font); flex: none; }
.tl-icb svg { width: 22px; height: 22px; }
.tl-icb[aria-pressed="false"] { color: var(--muted); background: #f1f5f9; }
.tl-icb:disabled { opacity: .4; }
.tl-pr { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) 5em; align-items: center; gap: 6px; }
.tl-pr label { font-weight: 800; font-size: 14px; color: var(--ink); }
.tl-pr label sub { font-size: .75em; }
.tl-num { min-width: 0; width: 100%; min-height: 44px; font: 700 16px var(--font); text-align: center; border: 2px solid var(--line); border-radius: 10px; box-sizing: border-box; padding: 0 4px; color: var(--ink); background: #fff; }
.tl-num.bad { border-color: var(--bad); background: #fff1f2; }
.tl-warn { color: var(--bad) !important; font-weight: 700; }
.tl-same { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; font-size: 14px; color: var(--ink); }
.tl-same input { width: 22px; height: 22px; accent-color: var(--sc); }
.tl-add { width: 100%; min-height: 48px; border-radius: 999px; border: 3px dashed var(--tl); background: #fff; color: var(--tl); font: 800 16px var(--font); cursor: pointer; }
.tl-add:disabled { opacity: .45; border-color: var(--line); color: var(--muted); }
.tl-formula { font: 700 15px/1.5 var(--font); color: var(--ink); }
.tl-formula .big { font-size: 19px; background: #f8fafc; border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; margin: 4px 0; overflow-wrap: anywhere; }
.tl-formula ul { margin: 4px 0; padding-left: 18px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tl-formula li { margin: 3px 0; }
.tl-formula li.sl { list-style: none; margin-left: -18px; padding-left: 8px; border-left: 6px solid var(--sc); }
.tl-formula .lbl { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; }
.tl-mat { display: inline-grid; grid-template-columns: repeat(3, auto); align-items: center; gap: 2px 6px; margin: 2px 0; font: 700 16px var(--font); }
.tl-mx { display: inline-grid; grid-template-columns: auto auto; gap: 1px 12px; padding: 2px 8px; border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); border-radius: 6px; text-align: center; }
.tl-mx.col { grid-template-columns: auto; }
.tl-mats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tl-mats > span.op { font-weight: 800; }
.tl-pt { width: 100%; border-collapse: collapse; font-size: 13px; }
.tl-pt th, .tl-pt td { border-top: 1px solid var(--line); padding: 4px 4px; text-align: left; vertical-align: top; }
.tl-pt thead th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.tl-pt .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.tl-pt-wrap { overflow-x: auto; }
.tl-share input { width: 100%; box-sizing: border-box; min-height: 44px; font: 600 13px var(--font); padding: 0 10px; border: 2px solid var(--line); border-radius: 10px; color: var(--ink); margin-top: 6px; }
.tl-fb { text-align: center; font-weight: 800; color: var(--muted); font-size: 15px; line-height: 1.45; }
.tl-fb .bx { margin: 4px 0 0; font-weight: 700; color: var(--ink); text-align: left; background: #f8fafc; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: 14px; }
.tl-fb .bx ol { margin: 4px 0; padding-left: 22px; }
.tl-sol li { margin: 2px 0; }
.tl-hintx { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--ink); background: #fffbeb; border: 2px solid #fde68a; border-radius: 12px; padding: 6px 10px; text-align: left; }
.tl-fb.ok > b { color: var(--ok); } .tl-fb.bad > b { color: var(--bad); } .tl-fb.near > b { color: #b45309; }
.tl-ch-obj { font: 800 18px/1.4 var(--font); color: var(--ink); text-align: center; background: #eff6ff; border: 2px solid #bfdbfe; border-radius: 12px; padding: 6px 10px; overflow-wrap: anywhere; }
.tl-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tl-acts .primary, .tl-acts .secondary { margin: 0; min-height: 48px; padding: 0 22px; font-size: 17px; box-shadow: none; }
.tl-acts .primary[hidden], .tl-acts .secondary[hidden] { display: none; }
.tl-act { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 16px var(--font); cursor: pointer; }
.tl-act.main { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-act.hint { border-color: #f59e0b; color: #92400e; background: #fffbeb; }
.tl-act:disabled { opacity: .45; cursor: default; }
.tl-act[hidden] { display: none; }
.tl-hash-note { background: var(--tl-soft); border: 2px solid var(--tl); border-radius: 12px; padding: 6px 10px; color: var(--ink) !important; font-weight: 700; }
.tl-hash-note[hidden] { display: none; }
.tl-names { display: grid; gap: 6px; }
.tl-names input { font: 700 16px var(--font); padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; min-width: 0; width: 100%; box-sizing: border-box; text-align: center; }
.tl-names input[hidden] { display: none; }
#game-opts[hidden], #g-level[hidden] { display: none; }
.tl sup, #overlay-result sup, #overlay-setup sup { font-size: .72em; line-height: 0; vertical-align: super; }
.tl sub { font-size: .72em; line-height: 0; vertical-align: sub; }
.tl-score { display: flex; flex-direction: column; gap: 4px; font-size: clamp(15px, 2vw, 22px); margin-bottom: 6px; }
.tl-recap { text-align: left; max-height: 36vh; overflow: auto; margin: 6px 0; }
.tl-recap:empty { display: none; }
.tl-recap h3 { margin: 4px 0 6px; font-size: 16px; }
.tl-recap ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: var(--ink); font-size: 14px; line-height: 1.5; }
.tl-recap li span { display: block; color: var(--muted); }
.tl-recap li span.a { color: var(--ink); font-weight: 700; }
.tl-err { text-align: center; font-weight: 800; color: var(--bad); padding: 20px; }

@media (orientation: portrait) {
  .tl-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .tl-left { height: clamp(270px, 46vh, 560px); border-right: 0; border-bottom: 3px solid var(--line); }
}
@media (max-width: 900px) { .tl-lg span { display: none; } .tl-lg { padding: 0 12px; } }
@media (max-width: 380px) {
  .tl-pr { grid-template-columns: 4.2em minmax(0, 1fr) 4.6em; gap: 4px; }
  .tl-play { padding: 0 10px; }
  .tl-panel { padding: 6px; }
  .tl-card { padding: 8px 8px; }
  .tl-lg { padding: 0 8px; }
}
@media (max-height: 520px) {
  .tl-wrap { grid-template-columns: minmax(0, 1fr) clamp(290px, 40%, 420px); }
  .tl-panel { padding: 6px; gap: 6px; }
  .tl-anim { padding: 3px 6px; }
}
@media (orientation: portrait) and (max-height: 520px) {
  .tl-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .tl * { transition: none !important; animation: none !important; } }

.tl-keytog { display: inline-flex; align-items: center; gap: 8px; }
.tl-keytog svg { width: 22px; height: 22px; flex: none; }
.tl-mrow { border-left: 6px solid var(--sc); padding: 4px 0 4px 8px; margin: 6px 0; font-size: 14px; color: var(--ink); overflow-x: auto; }
.tl-mrow > b { display: block; font-size: 13px; color: var(--sc); }
.tl-mats .op sub { font-size: .7em; }

.tl-fold { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px 0 2px; border: 0; background: transparent; color: var(--ink); font: 800 16px var(--font); cursor: pointer; text-align: left; }
.tl-fold svg { width: 22px; height: 22px; flex: none; transition: transform .15s; }
.tl-fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
.tl-card > h3:has(.tl-fold) { margin: 0; gap: 4px 8px; }
.tl-tag { font: 800 11px var(--font); padding: 3px 9px; border-radius: 999px; background: #dcfce7; color: #166534; }
.tl-tag.adv { background: #ede9fe; color: #5b21b6; }
.tl-card [id^="body-"] { margin-top: 4px; }
.tl-card [id^="body-"][hidden] { display: none; }
