/* sắp xếp câu */
.line {
  min-height: 74px; width: 100%; border: 3px dashed var(--sky-deep); border-radius: 18px; background: #fff;
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; justify-content: center; border-style: solid; border-width: 3px; border-color: #cfe6f6;
}
.line .cell {
  min-width: 64px; min-height: 52px; padding: 4px 8px; display: flex; align-items: center; justify-content: center;
  border-bottom: 4px solid var(--sky-deep); background: #f4faff; border-radius: 10px 10px 0 0;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 5.4vw, 26px); color: var(--ink);
}
.line .cell.filled { background: #fff3d8; border-bottom-color: #f0c24b; cursor: pointer; }
.line .cell.locked { background: #d8f5df; border-bottom-color: var(--ok); color: var(--ok); cursor: default; }
.line .cell.over { background: #ffe9b0; }
.line .cell.bad { background: #ffd9db; border-bottom-color: var(--bad); animation: shake .35s; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.tok {
  background: #dff0fb; border: 3px solid #a9d3ef; border-radius: 14px; padding: 8px 14px;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 5.4vw, 26px); color: var(--ink); box-shadow: 0 4px 0 #a9d3ef;
}
.tok.in { background: #fff3d8; border-color: #f0c24b; box-shadow: 0 4px 0 #f0c24b; }
.tok.used { visibility: hidden; }

/* ---------- kéo thả ---------- */
.drag { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.dragging { opacity: .35; }
.dragghost {
  position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) scale(1.06) rotate(-2deg);
  opacity: .95; box-shadow: 0 10px 22px rgba(15, 42, 79, .3);
}
[data-drop].over { outline: 4px solid var(--gold); outline-offset: 2px; }
.slot.over { background: #ffe9b0; border-radius: 10px 10px 0 0; outline-offset: 0; }
.hint { color: var(--ink-soft); font-size: 16px; align-self: center; }
.tok.sel { border-color: var(--btn-orange); background: #fff3d8; box-shadow: 0 4px 0 #e0a03a; }
.tok.bad { background: #ffd9db; border-color: var(--bad); box-shadow: 0 4px 0 var(--bad); animation: shake .35s; }
.tok.words-chip { font-size: clamp(18px, 4.8vw, 24px); }

/* nối hình */
.match-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.target { border-radius: 18px; min-width: 0; }
.target.bad { outline: 4px solid var(--bad); }
.mt { background: #fff; border: 3px dashed var(--sky-deep); padding: 8px; display: grid; gap: 6px; justify-items: center; }
.mt .pic { width: 100%; max-width: 130px; }
.zone { min-height: 6px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.zone .tok { box-shadow: none; background: #d8f5df; border-color: var(--ok); font-size: clamp(16px, 4.4vw, 21px); padding: 4px 10px; cursor: default; }

/* giỏ phân loại */
.baskets { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.baskets.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.baskets.n3 .bk-label, .baskets.n4 .bk-label { font-size: 30px; }
.bk0, .bk1, .bk2, .bk3 { border: 4px solid; border-radius: 6px 6px 26px 26px; padding: 8px 8px 12px; background: #fff; display: grid; gap: 8px; align-content: start; min-height: 170px; }
.bk0 { border-color: var(--btn-blue); }
.bk1 { border-color: var(--btn-orange); }
.bk2 { border-color: var(--ok); }
.bk3 { border-color: #b06ad8; }
.bk-label { font-family: var(--font-display); font-weight: 800; font-size: 36px; line-height: 1; }
.bk0 .bk-label { color: var(--btn-blue); }
.bk1 .bk-label { color: var(--btn-orange); }
.bk2 .bk-label { color: var(--ok); }
.bk3 .bk-label { color: #b06ad8; }
.baskets .zone { flex-direction: column; align-items: stretch; }

/* lật thẻ */
.mem-grid { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mem { position: relative; aspect-ratio: 1; padding: 0; background: transparent; perspective: 600px; }
.mem .face {
  position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; backface-visibility: hidden;
  transition: transform .35s; overflow: hidden; padding: 4px;
}
.mem .back { background: var(--btn-blue); color: #cfe8ff; font-size: 38px; box-shadow: 0 4px 0 #234f95; }
.mem .front { background: #fff; border: 3px solid #f0c24b; transform: rotateY(180deg); font-size: clamp(15px, 4.2vw, 19px); line-height: 1.15; text-align: center; overflow-wrap: anywhere; color: var(--ink); }
.mem .front img { width: 100%; height: 100%; object-fit: contain; }
.mem.flip .back { transform: rotateY(180deg); }
.mem.flip .front { transform: rotateY(0); }
.mem.done .front { border-color: var(--ok); background: #e7f9ec; }

/* tìm từ đúng */
.find-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.find {
  min-height: 62px; border-radius: 16px; background: #fff; border: 3px solid var(--sky-deep); box-shadow: 0 4px 0 var(--sky-deep);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 5.4vw, 26px); color: var(--ink); padding: 6px 10px; overflow-wrap: anywhere;
}
.find.on { background: #fff3d8; border-color: var(--btn-orange); box-shadow: 0 4px 0 #e0a03a; }
.find.good { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 4px 0 #168a35; }
.find.gone { opacity: .55; }
.find.bad { background: #ffd9db; border-color: var(--bad); animation: shake .35s; }
@media (prefers-reduced-motion: reduce) {
  .tok.bad, .find.bad { animation: none; }
  .mem .face { transition: none; }
}
