/* Góc ba mẹ — trang cho người lớn: dịu hơn các trò chơi nhưng vẫn cùng một nhà (chữ, màu, thẻ bo tròn, Gấu Con). Tiền tố lớp: gp- */
body[data-scene="ba-me"] { --sky1: #6FA3E8; --sky2: #EAF3FF; }

.gp { display: grid; gap: 16px; min-width: 0; --gp-line: #DCE4F3; --gp-tint: #F3F7FF; --gp-bar: #2B7FE0; }
.gp-card { min-width: 0; padding: 16px 18px; border-radius: 24px; background: #fff; box-shadow: 0 5px 0 rgba(30, 42, 94, .12); }
.gp-h { margin-bottom: 10px; }
.gp-h h2 { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.gp-h p, .gp-note, .gp-sub { font-size: .95rem; color: var(--soft); line-height: 1.4; }
.gp-two { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) {
  .gp-two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .gp-two.gp-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- cổng ba mẹ ---------- */
.gp-gate { justify-self: center; width: 100%; max-width: 560px; margin-top: clamp(0px, 4vh, 40px); padding: 22px 20px 26px;
  display: grid; justify-items: center; gap: 14px; text-align: center; }
.gp-gate-bear { width: clamp(88px, 24vw, 132px); height: auto; filter: drop-shadow(0 5px 0 rgba(30, 42, 94, .14)); }
.gp-gate-text { display: grid; gap: 8px; max-width: 44ch; }
.gp-gate-text h2 { font-size: clamp(1.5rem, 5.5vw, 1.9rem); font-weight: 800; line-height: 1.15; }
.gp-gate-text p { line-height: 1.4; }
.gp-gate-msg { min-height: 2.8em; display: grid; place-items: center; font-weight: 800; color: var(--navy); }
.gp-hold { position: relative; width: 132px; height: 132px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #fff;
  box-shadow: 0 7px 0 rgba(30, 42, 94, .18), 0 12px 18px rgba(30, 42, 94, .16); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform .12s, box-shadow .12s; }
.gp-hold.gp-on { transform: translateY(4px); box-shadow: 0 3px 0 rgba(30, 42, 94, .18); }
.gp-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.gp-ring circle { fill: none; stroke-width: 11; }
.gp-ring-bg { stroke: var(--gp-line); }
.gp-ring-fg { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .25s ease-out; }
.gp-hold.gp-on .gp-ring-fg { stroke-dashoffset: 0; transition: stroke-dashoffset 2s linear; }
.gp-lock { width: 54px; height: 54px; fill: var(--navy); pointer-events: none; }
@media (max-height: 560px) and (min-aspect-ratio: 5/4) {   /* điện thoại nằm ngang: gấu, lời dẫn, nút nằm một hàng */
  .gp-gate { max-width: 760px; margin-top: 0; padding: 12px 18px; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; text-align: left; gap: 16px; }
  .gp-gate-bear { width: 84px; }
  .gp-gate-msg { place-items: center start; min-height: 2.6em; }
  .gp-hold { width: 112px; height: 112px; }
}

/* ---------- đầu trang, tên bé ---------- */
.gp-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 14px; }
.gp-head-bear { width: clamp(72px, 18vw, 104px); }
.gp-head-bear .buddy { display: block; }
.gp-title { font-size: clamp(1.4rem, 5.2vw, 1.9rem); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.gp-lead { margin-top: 4px; line-height: 1.4; color: var(--soft); }
.gp-kid { grid-column: 1 / -1; display: grid; gap: 6px; padding: 12px 14px; border-radius: 18px; background: var(--gp-tint); }
.gp-kid label { font-weight: 800; }
.gp-kid-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.gp-input { flex: 1 1 220px; min-width: 0; max-width: 360px; height: 54px; padding: 0 16px; border-radius: 16px; border: 3px solid #C5CEE0; background: #fff;
  font: 700 1.2rem/1.2 var(--font-ui); color: var(--navy); -webkit-user-select: text; user-select: text; }
.gp-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(59, 156, 255, .25); }
.gp-input::placeholder { color: #9AA6C4; font-weight: 600; }
.gp-saved { font-size: .95rem; font-weight: 800; color: #1E8A55; min-height: 1.4em; }
@media (min-width: 820px) {
  .gp-head { grid-template-columns: auto minmax(0, 1.25fr) minmax(0, 1fr); }
  .gp-kid { grid-column: auto; }
}

/* ---------- bốn con số ---------- */
.gp-tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .gp-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.gp-tile { min-width: 0; padding: 12px 14px 14px; border-radius: 20px; background: #fff; box-shadow: 0 5px 0 rgba(30, 42, 94, .12); display: flex; flex-direction: column; gap: 2px; }
.gp-tile-label { font-size: .92rem; font-weight: 800; color: var(--soft); }
.gp-tile-value { font-size: clamp(1.6rem, 6.4vw, 2.1rem); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gp-tile-value small { font-size: .5em; font-weight: 800; color: var(--soft); }
.gp-tile-sub { font-size: .85rem; line-height: 1.3; color: var(--soft); }
.gp-meter { height: 8px; margin: 4px 0 2px; border-radius: 4px; background: #FFF0BF; overflow: hidden; }
.gp-meter i { display: block; height: 100%; border-radius: 4px; background: #E9A400; }

/* ---------- biểu đồ 7 ngày ---------- */
.gp-cols { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.gp-col { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 8px; border-radius: 14px; cursor: pointer; }
.gp-col.gp-today { background: #FFF5D1; }
.gp-col.gp-pick { box-shadow: inset 0 0 0 2px #B9C8EA; }
.gp-col:focus-visible { outline-width: 3px; outline-offset: 0; }
.gp-track { width: 100%; height: clamp(112px, 24vh, 168px); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--gp-line); }
.gp-val { font-size: .88rem; font-weight: 800; line-height: 1.3rem; height: 1.3rem; font-variant-numeric: tabular-nums; }
.gp-bar { flex: none; width: min(24px, 58%); height: calc((100% - 1.3rem) * var(--h, 0)); min-height: 3px; border-radius: 4px 4px 0 0; background: var(--gp-bar); }
.gp-bar.gp-zero { min-height: 0; height: 0; }
.gp-stars { display: inline-flex; align-items: center; gap: 2px; height: 1.4rem; font-size: .88rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.gp-stars.gp-none { color: #A9B3CC; }
.gp-star { display: inline-grid; flex: none; }
.gp-star .star { width: 1.05em; height: 1.05em; }
.gp-day { min-width: 2.3em; padding: 0 6px; border-radius: 999px; text-align: center; font-size: .9rem; font-weight: 800; line-height: 1.5; }
.gp-today .gp-day { background: var(--navy); color: #fff; }
.gp-date { font-size: .72rem; line-height: 1; color: var(--soft); font-variant-numeric: tabular-nums; }
.gp-cols.gp-empty .gp-track { height: 72px; }
.gp-info { margin-top: 10px; min-height: 2.7em; font-size: .92rem; line-height: 1.35; color: var(--soft); }

/* ---------- hôm nay ---------- */
.gp-today-nums { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 8px; }
.gp-today-nums p { color: var(--soft); font-weight: 800; }
.gp-today-nums b { font-size: 1.9rem; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.gp-missions { list-style: none; margin: 6px 0 8px; padding: 0; display: grid; gap: 6px; }
.gp-missions li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 14px; background: var(--gp-tint); }
.gp-missions i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #B9C6E4; background: #fff; font-style: normal; font-weight: 800; font-size: .95rem; line-height: 1; color: #fff; }
.gp-missions .gp-done i { background: #1E9E62; border-color: #1E9E62; }
.gp-missions span { font-weight: 800; overflow-wrap: anywhere; }
.gp-missions em { font-style: normal; font-size: .85rem; color: var(--soft); }

/* ---------- bé đã luyện gì ---------- */
.gp-dot { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--g, #7C879F); }
.gp-balance { margin-bottom: 14px; }
.gp-seg { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; }
.gp-seg i { flex: 1 1 0; min-width: 5px; }
.gp-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; color: var(--soft); }
.gp-legend li { display: inline-flex; align-items: center; gap: 6px; }
.gp-legend b { color: var(--navy); }
.gp-legend .gp-dot { width: 10px; height: 10px; }
.gp-groups { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .gp-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gp-group:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* nhóm lẻ cuối cùng trải hết hàng, không để ô trống */
}
.gp-group { min-width: 0; padding: 12px 14px; border-radius: 18px; background: var(--gp-tint); display: flex; flex-direction: column; gap: 10px; }
.gp-group h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1.08rem; font-weight: 800; line-height: 1.2; }
.gp-group h3 span { flex: 1; min-width: 0; }
.gp-group h3 small { flex: none; font-size: .88rem; font-weight: 800; color: var(--soft); }
.gp-act-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.gp-act-top span { min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.gp-act-top b { flex: none; font-size: .92rem; font-variant-numeric: tabular-nums; }
.gp-act-bar { height: 8px; margin: 3px 0; border-radius: 4px; background: #fff; overflow: hidden; }
.gp-act-bar i { display: block; height: 100%; border-radius: 4px; background: var(--g); }
.gp-act-meta { font-size: .82rem; line-height: 1.3; color: var(--soft); }
.gp-fresh { font-size: .9rem; line-height: 1.35; color: var(--soft); }
.gp-fresh span { font-weight: 800; }
.gp-mute { font-weight: 600 !important; }

/* ---------- bé thích nhất, gợi ý ---------- */
.gp-favlist, .gp-tiplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gp-favlist li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 12px; padding: 8px 12px; border-radius: 16px; background: var(--gp-tint); }
.gp-favlist i { grid-row: span 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); border: 3px solid #fff; box-shadow: 0 3px 0 rgba(30, 42, 94, .16);
  font-style: normal; font-weight: 800; font-size: 1.15rem; line-height: 1; color: var(--navy); }
.gp-favlist li:nth-child(2) i { background: #DDE5F2; } .gp-favlist li:nth-child(3) i { background: #F5C9A0; }
.gp-favlist span { font-weight: 800; font-size: 1.1rem; line-height: 1.2; overflow-wrap: anywhere; }
.gp-favlist small { font-size: .85rem; color: var(--soft); }
.gp-tiplist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px; background: #FFF8E1; }
.gp-tiplist p { line-height: 1.35; }
.gp-try { min-height: 48px; padding: 6px 16px; font-size: .95rem; white-space: nowrap; }

/* ---------- giấy khen ---------- */
/* giấy khen (cùng dòng tiêu đề của mục) luôn nằm trọn trong một màn hình, kể cả cửa sổ thấp; điện thoại nằm ngang thì chỉ cần tờ giấy khen vừa màn */
.gp-certbox { --gp-over: 112px; container-type: inline-size; width: 100%; margin: 0 auto;
  max-width: clamp(280px, calc((var(--vh, 100vh) - var(--bar, 78px) - var(--gp-over)) * 297 / 210), 860px); }
@media (max-height: 560px) { .gp-certbox { --gp-over: 28px; } }
.gp-cert { position: relative; aspect-ratio: 297 / 210; padding: .75em; border-radius: 1.3em; overflow: hidden; color: var(--navy);
  font-size: 1.9vw; font-size: 2.05cqw; line-height: 1.25;
  background: linear-gradient(120deg, #FF7B86, #FFB347, #FFD95A, #6FD48D, #5BC8D8, #6DA8FF, #A98BFF, #FF8CC4);
  box-shadow: 0 6px 18px rgba(30, 42, 94, .2); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gp-cert-in { position: relative; height: 100%; padding: 1.5em 2em 1.4em 1.2em; border-radius: .8em; background: #FFFDF4; outline: .1em dashed #E7B93C; outline-offset: -.65em;
  display: grid; grid-template-columns: 29% minmax(0, 1fr); align-items: center; gap: 1em; }
.gp-cert-side { position: relative; align-self: stretch; display: grid; place-items: center; }
.gp-cert-bear { width: 100%; max-height: 80%; object-fit: contain; filter: drop-shadow(0 .3em 0 rgba(30, 42, 94, .1)); }
.gp-cert-deco { position: absolute; font-size: 2.6em; }
.gp-cert-deco.gp-d1 { left: 4%; top: 8%; font-size: 3em; transform: rotate(-12deg); }
.gp-cert-deco.gp-d2 { right: 2%; top: 3%; font-size: 2em; transform: rotate(14deg); }
.gp-cert-deco.gp-d3 { left: 0; bottom: 7%; font-size: 3em; transform: rotate(-8deg); }
.gp-cert-main { min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; }
.gp-cert-brand { font-size: 1em; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--soft); }
.gp-cert-title { margin: 0; font-size: 4.5em; font-weight: 800; line-height: 1; letter-spacing: .05em; text-transform: uppercase; color: #E0404C; }
.gp-cert-give { font-size: 1.2em; color: var(--soft); }
.gp-cert-namebox { width: 100%; }
.gp-cert-name { display: inline-block; padding: 0 .3em .02em; font-size: calc(3.7em * var(--fit, 1)); font-weight: 800; line-height: 1.15; white-space: nowrap; border-bottom: .07em dotted #E7B93C; }
.gp-cert-why { font-size: 1.3em; }
.gp-cert-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: .5em .6em; }
.gp-cert-chip { display: inline-flex; align-items: center; gap: .35em; padding: .22em .85em .22em .6em; border-radius: 999px; background: #FFF4CC; border: .1em solid #F0CE62; font-size: 1.08em; font-weight: 600; white-space: nowrap; }
.gp-cert-chip b { font-weight: 800; }
.gp-cert-chip .emo, .gp-cert-chip .gp-star { font-size: 1.25em; }
.gp-cert-foot { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 1em; }
.gp-cert-date { font-size: 1em; color: var(--soft); }
.gp-cert-sign { display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 .5em; text-align: left; line-height: 1.1; }
.gp-cert-sign span { grid-row: span 2; display: grid; }
.gp-paw { width: 2.5em; height: 2.5em; fill: #D98A3D; transform: rotate(-14deg); }
.gp-cert-sign b { font-size: 1.3em; font-weight: 800; }
.gp-cert-sign small { font-size: .85em; color: var(--soft); }
.gp-cert-actions { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; }
.gp-cert-actions .gp-note { flex: 1 1 260px; max-width: 46ch; }
.gp-printbtn { min-height: 64px; }

/* ---------- lời khuyên, công cụ khác ---------- */
.gp-advgrid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .gp-advgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gp-advice { min-width: 0; padding: 14px 16px; border-radius: 18px; background: var(--gp-tint); display: grid; gap: 8px; align-content: start; }
.gp-advice h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 1.12rem; font-weight: 800; line-height: 1.2; }
.gp-advice h3 .emo { font-size: 1.7em; }
.gp-advice p, .gp-advice li { font-size: 1rem; line-height: 1.45; font-weight: 600; }
.gp-advice ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.gp-toolrow { display: flex; flex-wrap: wrap; gap: 12px; }
.gp-toolrow .plain { min-height: 60px; padding: 8px 22px; border-radius: 20px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; line-height: 1.2; }
.gp-toolrow small { font-size: .82rem; font-weight: 600; color: var(--soft); }

@media (max-width: 420px) {
  .gp-card { padding: 14px 12px; border-radius: 20px; }
  .gp-certsec { padding-inline: 8px; }
  .gp-val, .gp-stars { font-size: .8rem; }
  .gp-tiplist li { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; }
  .gp-try { justify-self: start; }
}

/* ---------- khi in ở trang này: chỉ còn tờ giấy khen, A4 nằm ngang. Mọi luật đều buộc vào body[data-scene="ba-me"]
   và một trang in có tên riêng, nên phiếu tập tô (in-bai) và các trang khác in như cũ. ---------- */
@page gp-giay-khen { size: A4 landscape; margin: 0; }
@media print {
  body[data-scene="ba-me"] { background: #fff !important; padding: 0 !important; min-height: 0; }
  body[data-scene="ba-me"] > :not(main), body[data-scene="ba-me"] .scene, body[data-scene="ba-me"] .bar, body[data-scene="ba-me"] #fx,
  body[data-scene="ba-me"] .gp > :not(.gp-certsec), body[data-scene="ba-me"] .gp-certsec > :not(.gp-certbox) { display: none !important; }
  body[data-scene="ba-me"] main { page: gp-giay-khen; display: block; max-width: none !important; margin: 0; padding: 0; }   /* !important: thắng luật "màn rộng" của style.css */
  body[data-scene="ba-me"] .gp, body[data-scene="ba-me"] .gp-certsec { display: block; margin: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  body[data-scene="ba-me"] .gp-certbox { max-width: none; margin: 0; padding: 5mm 10mm; box-sizing: border-box; }
  body[data-scene="ba-me"] .gp-cert { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  body[data-scene="ba-me"] .gp-cert-bear { filter: 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) {
  .gp-certbox { --cq: inline-size; }
  .gp-cert { font-size: calc(2.05 * var(--cqw)); }
  @media print { body[data-scene="ba-me"] .gp-cert { font-size: 5.68mm; } }
}
