/* Bài học mở rộng: Màu sắc, Hình dạng, Con vật (js/lessons-topics.js). Mọi lớp riêng đều bắt đầu bằng lt-. */
body[data-scene="mau-sac"] { --sky1: #FF8FB1; --sky2: #FFE9D6; }
body[data-scene="hinh-dang"] { --sky1: #6F8BFF; --sky2: #DFE7FF; }
body[data-scene="con-vat"] { --sky1: #45C1E6; --sky2: #E6F9D6; }

/* ---------- hình vẽ: quả bóng bóng loáng (màu) và khối đồ chơi nổi (hình) ---------- */
/* .lt-swatch là khung vuông 1em: nền của khung là bóng đổ dưới chân, <i> bên trong là quả bóng.
   Các sắc sáng / tối (--lt-l, --lt-d, --lt-k) do js/lessons-topics.js tính sẵn nên ở đây không cần color-mix(). */
.lt-swatch { --lt-c: #3B9CFF; --lt-l: #C4E1FF; --lt-d: #3672C9; --lt-k: #2F4A9B; position: relative; display: block; flex: none; width: 1em; aspect-ratio: 1;
  background: radial-gradient(ellipse 40% 7% at 50% 93.5%, rgba(30, 42, 94, .5), rgba(30, 42, 94, .2) 55%, rgba(30, 42, 94, 0) 100%); }
.lt-swatch > i { position: absolute; left: 5%; top: 0; width: 90%; height: 90%; border-radius: 50%;
  background:
    radial-gradient(circle at 31% 23%, #fff 0, rgba(255, 255, 255, .9) 3.5%, rgba(255, 255, 255, 0) 11%),
    radial-gradient(ellipse 30% 19% at 35% 25%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 100%),
    radial-gradient(ellipse 44% 13% at 57% 93%, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 100%),
    radial-gradient(circle at 36% 28%, var(--lt-l) 0, var(--lt-c) 36%, var(--lt-d) 76%, var(--lt-k) 100%); }
/* khối nổi vẽ bằng SVG (mặt bên, mặt vát, vệt bóng, bóng đổ đều nằm trong hình) */
.lt-shape { display: block; flex: none; width: 1em; height: 1em; overflow: visible; }

/* ---------- màn học ---------- */
/* js/lessons-topics.js đo màn hình rồi đặt: --lt-ph chiều cao thẻ lớn (nhận hết chỗ còn lại), --lt-pw chiều rộng thẻ ảnh con vật,
   --lt-max cỡ ô tối đa, và với 20 con vật: --lt-cols, --lt-tile, --lt-gap, --lt-sw. Các giá trị dưới đây là dự phòng khi chưa đo. */
.learn.lt-learn { --lt-a: calc(var(--vh) - var(--over)); --lt-gap: 12px; --lt-btn: 60px; --lt-cols: 4; --lt-max: 72px;
  --lt-ph: clamp(130px, calc(var(--lt-a) - 250px), 520px);
  --lt-f: clamp(18px, min(5.5vw, 5vh), 38px);
  gap: 14px; }
.learn.lt-n6 { --lt-cols: 3; }
.lt-learn .lt-show { box-sizing: border-box; height: var(--lt-ph); position: relative; }
.lt-show .pic { box-sizing: border-box; height: 100%; min-height: 0; gap: 6px; padding: 10px 8px; }
.lt-show .pic .w { font-size: var(--lt-f); white-space: nowrap; flex: none; }
.lt-show.lt-one { grid-template-columns: minmax(0, 1fr); }
/* hình lớn: chiếm hết phần còn lại của thẻ (đơn vị cqmin = 1% cạnh ngắn của khung) */
.lt-sym { display: grid; place-items: center; flex: 1 1 0; align-self: stretch; min-height: 0; min-width: 0; container-type: size; font-size: 96px; }
.lt-sym > .lt-swatch { width: 92cqmin; }
.lt-sym > .lt-shape { width: 90cqmin; height: 90cqmin; }
.lt-show .pic .lt-sym > .emo { font-size: 80cqmin; }
.lt-side { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }
.blocks.lt-blocks { grid-template-columns: repeat(var(--lt-cols), minmax(0, 1fr)); gap: var(--lt-gap); font-size: 30px; width: 100%; padding: 6px 0 0;
  max-width: calc(var(--lt-max) * var(--lt-cols) + (var(--lt-cols) - 1) * var(--lt-gap)); }
.lt-blocks .sel { transform: translateY(-4px) scale(1.08); outline-width: 4px; }
.lt-tile { padding: 0; min-width: 0; }
.lt-tile > .emo, .lt-tile > .lt-swatch, .lt-tile > .lt-shape { width: 78%; height: auto; aspect-ratio: 1; }
.lt-play { min-height: var(--lt-btn, 60px); padding: 2px 34px; flex: none; }
@media (min-width: 621px) {
  .learn.lt-n8 { --lt-cols: 8; --lt-max: 84px; }
  .learn.lt-n6 { --lt-cols: 6; --lt-max: 84px; }
}
@media (max-height: 560px) {
  .lt-ask { display: none; }
  .learn.lt-learn { --lt-btn: 50px; }
}
/* điện thoại nằm ngang: thẻ lớn bên trái, các ô chọn và nút chơi bên phải */
@media (max-height: 560px) and (min-aspect-ratio: 5/4) {
  .learn.lt-learn { --lt-cols: 4; --lt-max: 84px; align-items: center; }
  .learn.lt-n6 { --lt-cols: 3; }
  .lt-side { gap: 12px; }
  /* mũi tên đè lên hai góc thẻ để thẻ được rộng hết cột */
  .lt-learn .stagecard { grid-template-columns: minmax(0, 1fr); }
  .lt-learn .stagecard > .round { position: absolute; top: -8px; z-index: 1; width: 44px; height: 44px; }
  .lt-learn .stagecard > .round:first-child { left: -4px; }
  .lt-learn .stagecard > .round:last-child { right: -4px; }
}

/* ---------- con vật: ảnh thật (js/photos.js) phủ kín thẻ, 20 ô ---------- */
/* màn rộng: cột nội dung rộng 1280px (cơ chế --wide của css/style.css) để ảnh to được */
@media (min-width: 1040px) and (min-height: 561px) { body[data-scene="con-vat"] { --wide: 1280px; } }
.lt-photo { display: block; object-fit: cover; -webkit-user-drag: none; user-select: none; }
.lt-animal .stagecard { display: block; width: var(--lt-pw, 100%); max-width: 100%; margin-inline: auto; }
.lt-animal .lt-show { display: block; padding: 0; border-width: 5px; overflow: hidden; }
.lt-animal .lt-show .pic { position: absolute; inset: 0; width: auto; height: auto; padding: 0; border-radius: 0; background: #DCEBF2; }
.lt-animal .lt-sym { position: absolute; inset: 0; }
.lt-sym > .lt-photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.lt-animal .lt-show .pic .w { position: absolute; left: 50%; bottom: clamp(8px, 2.4vh, 16px); z-index: 1; transform: translateX(-50%); box-sizing: border-box; max-width: calc(100% - 20px);
  padding: .08em .7em .12em; border-radius: 999px; background: rgba(255, 255, 255, .95); font-size: clamp(22px, min(7vw, 6.4vh), 46px); line-height: 1.2;
  box-shadow: 0 4px 0 rgba(30, 42, 94, .28), 0 0 0 3px rgba(255, 255, 255, .45); overflow: hidden; text-overflow: ellipsis; }
.lt-animal .lt-show .pic .w.lt-long { font-size: clamp(19px, min(5.8vw, 5.6vh), 40px); }
/* mũi tên trước / sau nằm đè lên hai mép ảnh */
.lt-animal .stagecard > .round { position: absolute; top: calc(50% - 26px); z-index: 2; width: 52px; height: 52px; }
.lt-animal .stagecard > .round:first-child { left: 12px; }
.lt-animal .stagecard > .round:last-child { right: 12px; }
.lt-tile.lt-ph { position: relative; overflow: hidden; }
.lt-tile > .lt-photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.lt-tile.lt-ph > .emo { width: auto; height: 74%; max-width: 86%; }
/* nút nhỏ ghi nguồn ảnh + bảng tác giả */
.lt-info { position: absolute; right: 9px; top: 9px; z-index: 2; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(30, 42, 94, .3); background: rgba(255, 255, 255, .9); color: rgba(30, 42, 94, .7); font: italic 700 15px/1 Georgia, 'Times New Roman', serif; }
.lt-credits { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 14px; background: rgba(30, 42, 94, .5); }
.lt-credits-in { box-sizing: border-box; max-width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 14px 18px; border-radius: 20px; background: #fff; color: var(--navy);
  font-size: 13px; line-height: 1.45; text-align: left; box-shadow: var(--lift); }
.lt-credits-in h3 { margin: 0 0 6px; font-size: 16px; }
.lt-credits-in ul { margin: 0; padding: 0; list-style: none; columns: 2 220px; column-gap: 18px; }
.lt-credits-in li { break-inside: avoid; }
.lt-credits-in p { margin: 8px 0 0; opacity: .7; font-size: 12px; }

/* 20 ô: màn hình dọc là dải 2 hàng (hoặc 1 hàng khi thấp) dưới ảnh, cuộn ngang nếu không đủ rộng;
   màn hình ngang là lưới 4 × 5 bên phải ảnh. Ô không bao giờ nhỏ hơn 56px. */
.learn.lt-n20 { --lt-cols: 10; --lt-tile: 60px; --lt-gap: 10px; }
.lt-n20 .lt-blocks { grid-template-columns: repeat(var(--lt-cols), var(--lt-peek, var(--lt-tile))); justify-content: start; box-sizing: border-box; width: auto; max-width: 100%;
  padding: 12px 10px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; position: relative; }
.lt-n20 .lt-blocks::-webkit-scrollbar { display: none; }
.lt-n20 .lt-side { gap: 2px; }
@media (min-aspect-ratio: 5/4) {
  .learn.lt-animal { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; gap: 14px; }
  .lt-animal .lt-side { width: var(--lt-sw, 300px); gap: 6px; }
}

/* ---------- trò chơi nhỏ ---------- */
.quiz.lt-quiz { padding-top: clamp(4px, 3vh, 26px); }
.opts.lt-opts { max-width: min(660px, calc((var(--vh) - var(--over) - 86px) * 3)); min-width: min(100%, 250px); }
/* js đo màn hình và đặt cỡ ô: --lt-qc số cột (3 hoặc 1), --lt-qw × --lt-qh cỡ ô */
.opts.lt-opts.lt-fit { grid-template-columns: repeat(var(--lt-qc), var(--lt-qw)); gap: var(--lt-qg); justify-content: center; width: auto; max-width: none; min-width: 0;
  font-size: clamp(36px, calc(var(--lt-qh) * .32), 76px); }
.lt-fit .lt-tile { width: var(--lt-qw); height: var(--lt-qh); aspect-ratio: auto; }
.lt-opts .lt-tile { transition: transform .1s, box-shadow .1s, opacity .25s; }
.lt-opts .lt-ok { outline: 6px solid var(--green); outline-offset: 3px; animation: bump .35s; }
.lt-opts .lt-dim { opacity: .4; }

/* ---------- hình trên thẻ ở trang chủ ---------- */
.card .art > .lt-swatch, .card .art > .lt-shape { width: min(1.2em, 28%); height: auto; aspect-ratio: 1; }
.card .art > .lt-artph { position: relative; display: grid; place-items: center; flex: none; width: 1.12em; height: 1.12em; overflow: hidden; border: 3px solid #fff; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 0 rgba(30, 42, 94, .22); }
.lt-artph > .lt-photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.lt-artph > .emo { font-size: .8em; }

/* ---------- wave 5: polish ---------- */
/* nút "i" (nguồn ảnh, dành cho ba mẹ) vẫn nhỏ như cũ nhưng vùng chạm rộng 46px cho dễ bấm */
.lt-info::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }

/* ---------- wave 7: 3D (hình nổi như đồ chơi thật) ---------- */
/* phông sau hình lớn như một góc chụp ảnh: sáng ở giữa, ngả theo màu đang học (--lt-t do js đặt), có mặt sàn mờ dưới chân */
.lt-show:not(.lt-one) .pic { --lt-t: #9CCBFF;
  background:
    linear-gradient(rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0) 58%, rgba(30, 42, 94, .1) 58%, rgba(30, 42, 94, .02) 100%),
    radial-gradient(ellipse 80% 62% at 50% 40%, #fff 0, rgba(255, 255, 255, .9) 40%, rgba(255, 255, 255, .6) 100%),
    var(--lt-t);
  box-shadow: inset 0 3px 8px rgba(30, 42, 94, .12), inset 0 -2px 0 rgba(255, 255, 255, .7); }
.lt-show:not(.lt-one) .pic.lt-o { --lt-t: #FFD66B; }
.lt-show:not(.lt-one) .pic .w { position: relative; z-index: 1; box-shadow: 0 4px 0 rgba(30, 42, 94, .18), 0 8px 10px rgba(30, 42, 94, .12); }
.lt-show .pic.lt-o .lt-sym > .emo { filter: drop-shadow(0 .05em .04em rgba(30, 42, 94, .28)); }
/* quả bóng và khối nổi lơ lửng nhè nhẹ */
.lt-sym > .lt-swatch > i { animation: lt-float 3.4s ease-in-out infinite; }
.lt-sym > .lt-shape { transform-origin: 50% 62%; animation: lt-sway 5s ease-in-out infinite; }
@keyframes lt-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4%); } }
@keyframes lt-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-2%); } }
/* ô chọn: mặt ô hơi lõm, sáng ở trên */
.lt-tile:not(.lt-ph) { background: radial-gradient(ellipse 90% 70% at 50% 34%, #fff 0, #fff 45%, #E9EFFF 100%); }
/* các đồ vật khác cùng màu / cùng hình: nút tròn nổi ở góc thẻ đồ vật (≥ 64px) */
.lt-more { position: absolute; z-index: 2; top: 22px; right: 22px; left: calc(50% + 15px); display: flex; justify-content: space-between; pointer-events: none; }
.lt-mini { pointer-events: auto; display: grid; place-items: center; flex: none; width: 64px; height: 64px; padding: 0; border: 3px solid #fff; border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, #fff 0, #F6F8FF 44%, #D3DCF5 100%);
  box-shadow: inset 0 -5px 7px rgba(30, 42, 94, .13), 0 4px 0 rgba(30, 42, 94, .24), 0 9px 10px rgba(30, 42, 94, .2); transition: transform .1s, box-shadow .1s; }
.lt-mini:active { transform: translateY(3px); box-shadow: inset 0 -5px 7px rgba(30, 42, 94, .13), 0 1px 0 rgba(30, 42, 94, .24); }
.lt-mini > .emo { font-size: 38px; filter: drop-shadow(0 2px 1px rgba(30, 42, 94, .25)); }
.lt-show .pic.lt-many { padding-top: 78px; }
@media (max-width: 620px) {
  .lt-more { top: 16px; right: 16px; left: calc(50% + 11px); }
  /* tên dài ("màu xanh dương", "hình chữ nhật") không tràn sang thẻ bên cạnh */
  .lt-show:not(.lt-one) .pic .w { max-width: 100%; padding-inline: 10px; }
  .lt-show:not(.lt-one) .pic .w.lt-long { font-size: calc(var(--lt-f) * .74); padding-inline: 6px; }
}
@media (max-height: 560px) {
  .lt-show:not(.lt-one) .pic .w { max-width: 100%; }
  .lt-show:not(.lt-one) .pic .w.lt-long { font-size: calc(var(--lt-f) * .8); padding-inline: 8px; }
}
/* màn ngang: hai nút xếp dọc ở mép phải thẻ, hình to vẫn nằm giữa */
@media (min-aspect-ratio: 5/4) {
  .lt-more { left: auto; flex-direction: column; gap: 10px; }
  .lt-show .pic.lt-many { padding-top: 10px; }
}
/* màn hình thấp (điện thoại nhỏ, điện thoại nằm ngang): thẻ không đủ chỗ cho nút 64px mà hình vẫn to →
   các đồ vật khác chỉ ló ra nho nhỏ ở góc, không bấm được; bé chạm hình to để đổi (js xem pointer-events để biết) */
@media (max-width: 620px) and (max-height: 739.98px), (max-height: 560px) {
  .lt-more { top: 11px; right: auto; left: calc(50% + 8px); flex-direction: row; justify-content: flex-start; gap: 0; }
  .lt-mini { pointer-events: none; width: 30px; height: 30px; border-width: 2px; margin-right: -8px; box-shadow: 0 2px 0 rgba(30, 42, 94, .22), 0 4px 6px rgba(30, 42, 94, .18); }
  .lt-mini > .emo { font-size: 17px; }
  .lt-show .pic.lt-many { padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .lt-sym > .lt-swatch > i, .lt-sym > .lt-shape { animation: none; } }

/* ---------- wave 6: compat (trình duyệt cũ) ---------- */
/* Bản dự phòng cho máy cũ của các luật phía trên (giải thích ở cuối css/style.css); sửa luật gốc thì sửa luôn dòng tương ứng ở đây. */
/* chưa có đơn vị cqw/cqh, @container */
@supports not (width: 1cqw) {
  .lt-sym { --cq: size; contain: size; }
  .lt-sym > .lt-swatch { width: min(calc(92 * var(--cqw)), calc(92 * var(--cqh))); }
  .lt-sym > .lt-shape { width: min(calc(90 * var(--cqw)), calc(90 * var(--cqh))); height: min(calc(90 * var(--cqw)), calc(90 * var(--cqh))); }
  .lt-show .pic .lt-sym > .emo { font-size: min(calc(80 * var(--cqw)), calc(80 * var(--cqh))); }
}
