/* TTS Matematika: Kotak Angka. Papan persamaan + deretan angka */
.kt-body { position: relative; flex: 1; min-height: 0; display: flex; gap: clamp(8px, 1.6vw, 22px); padding: clamp(8px, 1.4vw, 18px); background: linear-gradient(135deg, var(--sky-50), var(--amber-100) 85%); }
.kt-main { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.kt-info { flex: 0 0 auto; background: #fff; border: 3px solid var(--sky); border-radius: 14px; padding: 6px 12px; font-weight: 800; color: var(--ink); font-size: clamp(13px, 1.6vw, 22px); line-height: 1.25; min-height: 2.4em; display: flex; align-items: center; }
.kt-gridwrap { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.kt-grid { display: grid; gap: 3px; padding: 4px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

.kc { position: relative; display: flex; align-items: center; justify-content: center; border-radius: 6px; min-width: 0; min-height: 0; font-weight: 800; line-height: 1; font-size: calc(var(--cs, 40px) * .5); font-variant-numeric: tabular-nums; }
.kc.off { background: transparent; }
.kc.kn { background: #fef3c7; color: var(--ink); box-shadow: 0 0 0 2px #d6b46a; }
.kc.ko { background: var(--sky-100); color: var(--sky-d); box-shadow: 0 0 0 2px #93c5fd; }
.kc.ke { background: transparent; color: var(--muted); }
.kc.kb { background: #fff; color: var(--sky-d); box-shadow: 0 0 0 2px var(--ink); cursor: pointer; }
.kc.kb.isi { background: var(--sky-100); }
.kc.kb.cur { background: var(--amber); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 3px var(--ink); color: var(--ink); }
.kc.kb.cur.isi { background: var(--amber); }
.kc.kb.ok { background: #bbf7d0; color: var(--ok); }
.kc.kb.salah { background: var(--rose-100); color: var(--bad); }
.kc.kb.hint { color: var(--violet); }
.kc.kn.pk3 { font-size: calc(var(--cs, 40px) * .4); }
.kc.kn.pk4 { font-size: calc(var(--cs, 40px) * .32); }
.kc.kb.pk3 { font-size: calc(var(--cs, 40px) * .4); }
.kc.kb.pk4 { font-size: calc(var(--cs, 40px) * .32); }
.kc.ko.log { font-size: calc(var(--cs, 40px) * .34); }
.kc.kn.t { font-size: calc(var(--cs, 40px) * .34); }
.kc.kn.t.panjang { font-size: calc(var(--cs, 40px) * .27); }
.kc.sambung { box-shadow: 0 0 0 2px #d6b46a, inset 0 0 0 3px #bbf7d0; }

.kt-side { flex: 0 0 clamp(250px, 32%, 460px); min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.kt-tools { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kt-time { font-weight: 800; font-variant-numeric: tabular-nums; background: #fff; border: 3px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: clamp(13px, 1.5vw, 20px); }
.kt-btn { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--sky); color: #fff; font: inherit; font-weight: 800; font-size: clamp(13px, 1.4vw, 18px); cursor: pointer; box-shadow: 0 3px 0 var(--sky-d); }
.kt-btn.ghost { background: #fff; color: var(--sky-d); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); }
.kt-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sky-d); }
.kt-btn:disabled { opacity: .45; cursor: default; }

.kt-tray { flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; background: rgba(255, 255, 255, .6); border: 2px solid var(--line); border-radius: 14px; padding: 10px; }
.tile { display: flex; align-items: center; justify-content: center; min-width: clamp(52px, 6vw, 84px); height: clamp(48px, 7vh, 72px); padding: 0 10px; border: 0; border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-weight: 800; font-size: clamp(18px, 2.4vw, 32px); font-variant-numeric: tabular-nums; cursor: pointer; box-shadow: 0 4px 0 var(--line), 0 0 0 2px var(--line); touch-action: manipulation; }
.tile:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line), 0 0 0 2px var(--line); }
.tile.sel { background: var(--amber); box-shadow: 0 4px 0 #b45309, 0 0 0 3px var(--ink); }
.tile.pakai { visibility: hidden; }

.kt-toast { position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 8px 18px; border-radius: 999px; font-weight: 800; font-size: clamp(13px, 1.5vw, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 5; max-width: 90%; text-align: center; }
.kt-toast.show { opacity: 1; transform: translate(-50%, 0); }

.pk-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.pk { position: relative; min-height: 48px; border: 3px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px; }
.pk .no { font-weight: 800; font-size: 1.1em; }
.pk .tt { font-size: .7em; color: var(--muted); font-variant-numeric: tabular-nums; }
.pk .tt:empty { display: none; }
.pk .ok { position: absolute; top: 1px; right: 4px; color: var(--ok); font-weight: 800; font-size: .8em; }
.pk[aria-pressed="true"] { border-color: var(--sky); background: var(--sky-100); }
.pk.done { border-color: var(--emerald); }
.hint { font-weight: 600; color: var(--muted); }

@media (max-width: 700px) and (orientation: portrait) {
  .kt-body { flex-direction: column; overflow-y: auto; }
  .kt-main { flex: 0 0 auto; }
  .kt-gridwrap { flex: 0 0 auto; height: min(96vw, 58vh); }
  .kt-side { flex: 0 0 auto; }
  .kt-tray { flex: 0 0 auto; overflow: visible; }
}
@media (max-height: 520px) {
  .kt-body { padding: 6px 10px; gap: 8px; }
  .kt-main { gap: 4px; }
  .kt-info { display: none; }
  .kt-side { gap: 6px; flex-basis: clamp(230px, 34%, 400px); }
  .kt-btn { min-height: 36px; padding: 0 12px; box-shadow: 0 2px 0 var(--sky-d); }
  .tile { height: 42px; min-width: 46px; font-size: 18px; }
  .kt-tray { gap: 6px; padding: 6px; }
}
@media (prefers-reduced-motion: reduce) { .kt-toast { transition: none; } }

.op-desc.notasi { background: #ede9fe; border: 2px solid #c4b5fd; border-radius: 12px; padding: 8px 12px; color: #4c1d95; font-weight: 700; line-height: 1.4; }
.kt-info { font-size: clamp(12px, 1.35vw, 19px); }
.kt-toast { white-space: normal; }
