/* "Hôm nay của bé": ba nhiệm vụ mỗi ngày, hộp quà, chuỗi ngày chăm học (js/app.js: todayPanel, openGift) */
.td { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border: 6px solid transparent; border-radius: 30px;
  background: linear-gradient(#fff, #fff) padding-box, var(--rainbow) border-box; box-shadow: var(--lift); }
.td h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; font-size: clamp(1.25rem, 4.8vw, 1.7rem); line-height: 1.1; }
.td-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-streak { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px 4px 6px; border-radius: 999px; background: #FFE9C7; color: #A8480B; font-size: .62em; white-space: nowrap; }
.td-streak .emo { width: 1.5em; height: 1.5em; font-size: 1.3em; }
.td-row { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2.6vw, 26px); align-items: start; }
/* đường chấm nối ba nhiệm vụ tới hộp quà */
.td-row::before { content: ""; position: absolute; left: 12%; right: 12%; top: clamp(34px, 10vw, 66px); border-top: 7px dotted #C6D2F6; }
.td-m, .td-gift { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--navy); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform .22s cubic-bezier(.3, 1.7, .5, 1); }
.td-m:active, .td-gift:active { transform: translateY(4px) scale(.96); transition-duration: .06s; }
.td-art { --c: inherit; display: flex; align-items: center; justify-content: center; gap: 1px; width: min(100%, 132px); aspect-ratio: 1; overflow: hidden; border: 5px solid #fff; border-radius: 50%;
  font-size: clamp(19px, 5.4vw, 34px); background: radial-gradient(circle at 80% 16%, rgba(255, 255, 255, .5) 0 12%, transparent 13%), linear-gradient(160deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 58%, #000), 0 12px 14px rgba(30, 42, 94, .2); }
.td-art .emo { width: 1.25em; height: 1.25em; }
.td-art .block { width: 1.15em; font-size: .78em; }
.td-art .lt-artph { width: 1.2em; height: 1.2em; }
.td-art > * { flex: none; }
.td-name { max-width: 100%; font-weight: 800; font-size: clamp(.82rem, 3.3vw, 1.15rem); line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.td-ok, .td-no { position: absolute; top: -4px; right: max(0px, calc(50% - 74px)); display: grid; place-items: center; width: clamp(26px, 7.4vw, 38px); aspect-ratio: 1; border: 3px solid #fff; border-radius: 50%;
  font: 800 clamp(.85rem, 3.4vw, 1.2rem)/1 var(--font-letter, inherit); font-style: normal; color: #fff; box-shadow: 0 3px 0 rgba(30, 42, 94, .25); }
.td-no { background: var(--navy); }
.td-ok { background: #1FAE54; animation: td-pop .5s cubic-bezier(.3, 1.8, .5, 1) both; }
.td-m.done .td-art { filter: saturate(.55) brightness(1.08); }
.td-m.done .td-name { color: #1A8F45; }
/* hộp quà: khoá (mờ, đếm 0/3) → sẵn sàng (rung rinh, toả sáng) → đã mở */
.td-gift .emo { width: min(100%, 132px); height: auto; aspect-ratio: 1; font-size: clamp(50px, 15vw, 110px); filter: grayscale(.45) opacity(.78); transition: filter .3s; }
.td-gift.ready .emo { filter: drop-shadow(0 0 14px #FFD23F); animation: td-wig 1.1s ease-in-out infinite; }
.td-gift.open .emo { filter: none; }
.td-count { padding: 2px 12px; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 800; font-size: clamp(.82rem, 3.3vw, 1.1rem); line-height: 1.3; white-space: nowrap; }
.td-gift.ready .td-count { background: var(--orange); }
.td-gift.open .td-count { background: #1FAE54; }
.td-gift.bd-shy { animation: wobble .45s; }
@keyframes td-wig { 0%, 100% { transform: rotate(-7deg) scale(1); } 50% { transform: rotate(7deg) scale(1.1); } }
@keyframes td-pop { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }

/* thẻ lớn của nhóm "Cùng Gấu Con" */
.td-gau .card .art { height: clamp(120px, 28vw, 200px); font-size: clamp(46px, 12vw, 84px); }
@media (max-width: 719px) { .td-gau { grid-template-columns: repeat(2, minmax(0, 1fr)); } .td-gau > .card:first-child:nth-last-child(odd) { grid-column: 1 / -1; } }

/* dấu "xong nhiệm vụ" hiện giữa lúc chơi: không nhận chạm, tự biến mất */
.td-tick { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 8px; padding: 8px 18px 8px 8px; border-radius: 999px;
  background: #1FAE54; color: #fff; border: 4px solid #fff; font-weight: 800; font-size: clamp(1rem, 4.4vw, 1.4rem); white-space: nowrap; pointer-events: none; box-shadow: var(--lift);
  transform: translateX(-50%); animation: td-tick 2.6s both; }
.td-tick i { display: grid; place-items: center; width: 1.7em; aspect-ratio: 1; border-radius: 50%; background: #fff; color: #1FAE54; font-style: normal; }
@keyframes td-tick { 0% { opacity: 0; transform: translate(-50%, 40px) scale(.7); } 10%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, 20px) scale(.9); } }

/* nút "Nhiệm vụ tiếp theo" ở màn "Giỏi quá!" */
.finish .td-next { display: inline-flex; align-items: center; gap: 10px; padding-left: 8px; animation: pulse 1.4s ease-in-out infinite; }
.finish .td-next .td-art { width: 52px; border-width: 3px; font-size: 15px; box-shadow: none; background: #fff; }
.finish .td-next .td-art .emo { width: 1.9em; height: 1.9em; }
.finish.has-next .row { flex-wrap: wrap; justify-content: center; }

/* mở quà */
.td-open { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(30, 42, 94, .62); animation: td-fade .25s both; }
.td-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 2vh, 14px); width: min(100%, 560px); max-height: 100%; padding: clamp(12px, 3vh, 22px) 16px; overflow: hidden;
  border: 6px solid transparent; border-radius: 36px; background: linear-gradient(#FFFBEA, #fff) padding-box, var(--rainbow) border-box; box-shadow: var(--lift); text-align: center; }
.td-card h2 { font-weight: 800; font-size: clamp(1.8rem, 8vw, 3rem); line-height: 1; color: var(--yellow); text-shadow: var(--outline); }
.td-stagebox { position: relative; display: grid; place-items: center; width: min(62vw, 42vh, 260px); aspect-ratio: 1; }
.td-box, .td-prize { grid-area: 1 / 1; display: grid; place-items: center; width: 100%; height: 100%; }
.td-box .emo, .td-prize > .emo { width: 100%; height: 100%; font-size: min(50vw, 34vh, 210px); }
.td-box { animation: td-shake .28s ease-in-out 4; }
.td-prize { position: relative; opacity: 0; transform: scale(.2); }
.td-prize .bd-rays { width: 160%; height: 160%; margin: -80% 0 0 -80%; top: 50%; animation: td-rays 5s linear infinite; opacity: 1; z-index: -1;
  background: repeating-conic-gradient(rgba(255, 210, 63, .55) 0 10deg, transparent 10deg 20deg); -webkit-mask: radial-gradient(#000 30%, transparent 68%); mask: radial-gradient(#000 30%, transparent 68%); }
.td-open.pop .td-box { animation: td-out .3s forwards; }
.td-open.pop .td-prize { animation: td-in .7s cubic-bezier(.3, 1.7, .5, 1) .15s forwards; }
.td-card > .buddy { position: absolute; left: 4px; bottom: 4px; width: clamp(56px, 16vw, 96px); }
.td-prize, .td-prize .bd-rays, .td-box { pointer-events: none; }
.td-card .row { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.td-card .btn { font-size: clamp(1.1rem, 5vw, 1.5rem); min-height: 58px; padding-inline: 22px; }
.td-card .btn[disabled] { opacity: .45; }
@keyframes td-fade { from { opacity: 0; } }
@keyframes td-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg) scale(1.05); } 75% { transform: rotate(9deg) scale(1.05); } }
@keyframes td-out { to { transform: scale(1.6); opacity: 0; } }
@keyframes td-in { to { transform: none; opacity: 1; } }
@keyframes td-rays { to { transform: rotate(360deg); } }
@media (max-height: 520px) { .td-card { flex-direction: row; flex-wrap: wrap; justify-content: center; } .td-card h2 { width: 100%; font-size: 1.6rem; } .td-stagebox { width: min(40vh, 180px); } .td-card > .buddy { display: none; } }

@media (min-width: 900px) { .td { padding: 14px 22px 18px; } .td-row { gap: 34px; } }
@media (prefers-reduced-motion: reduce) {
  .td-gift.ready .emo, .td-ok, .td-box, .finish .td-next, .td-prize .bd-rays { animation: none; }
  .td-open.pop .td-box { animation: none; opacity: 0; } .td-open.pop .td-prize { animation: none; opacity: 1; transform: none; }
  .td-tick { animation: none; }
}

/* lối vào Góc ba mẹ ở cuối trang chủ (có cổng giữ 2 giây nên bé không lạc vào) */
.td-parent { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px 10px 10px; border: 0; border-radius: 26px; background: linear-gradient(120deg, #EAF2FF, #fff); box-shadow: var(--lift);
  font: inherit; color: var(--navy); text-align: left; cursor: pointer; transition: transform .2s; }
.td-parent:active { transform: translateY(4px); }
.td-parent .td-pic { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #D7E6FF; }
.td-parent .td-pic img { width: 46px; height: 46px; animation: none; }
.td-parent > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.td-parent b { font-weight: 800; font-size: 1.25rem; line-height: 1.2; }
.td-parent small { color: var(--soft); font-size: .9rem; line-height: 1.25; }
.td-parent i { flex: none; display: grid; } .td-parent i svg { width: 28px; height: 28px; fill: var(--blue); }
/* hình thẻ có ba món trở lên: thu nhỏ một chút cho vừa vòng tròn */
.td-art.td-3 { font-size: clamp(14px, 4vw, 27px); }

/* ---------- 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ó color-mix() */
@supports not (color: color-mix(in srgb, red, blue)) {
  .td-art { --ck: inherit; background: radial-gradient(circle at 80% 16%, rgba(255, 255, 255, .5) 0 12%, transparent 13%), linear-gradient(160deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0)), var(--c); box-shadow: 0 6px 0 rgba(0, 0, 0, .42), 0 6px 0 var(--c), 0 12px 14px rgba(30, 42, 94, .2); }
}
