/* 🏠 Trang chủ (app.js VIEWS.home): bento of tiles, the user's choice 2026-10-01 = design B of graphics/home_options.html
   with the month calendars and hexagon badges of design C. Every class is `hb-`; lesson colours come from library.css (.lb-*). */
:root { --hb-hat: #f6bd33; --hb-hat-soft: #fff1c9; --hb-hat-ink: #3a2a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hb-hat: #e6b64f; --hb-hat-soft: #3a2f14; --hb-hat-ink: #2a1e00; } }
:root[data-theme="dark"] { --hb-hat: #e6b64f; --hb-hat-soft: #3a2f14; --hb-hat-ink: #2a1e00; }

.hb-bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hb-bento > .card { margin: 0; min-width: 0; }
.hb-s2 { grid-column: span 2; } .hb-s3 { grid-column: span 3; } .hb-s4 { grid-column: span 4; }
.hb-bento h2 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.hb-bento h2::before { display: none; }
.hb-bento h2 svg.ic { margin: 0; }

/* calendar tile */
.hb-calcard { display: grid; gap: 14px; align-content: start; }
.hb-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hb-koala { width: 58px; height: 52px; flex: none; }
.hb-hello { flex: 1; min-width: 200px; }
.hb-legend { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--ink-3); margin-right: 6px; }
.hb-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.hb-legend .l0, .hb-cal-g .d.l0 { background: var(--hm0); }
.hb-legend .l1 { background: var(--hm1); } .hb-legend .l2 { background: var(--hm2); } .hb-legend .l3 { background: var(--hm3); } .hb-legend .l4 { background: var(--hm4); }
.hb-cals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.hb-cal h3 { margin: 0 0 6px; font-size: .95rem; }
.hb-cal h3 small { color: var(--ink-3); font-weight: 700; }
.hb-cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hb-cal-g .wd { font-size: .68rem; font-weight: 800; color: var(--ink-3); text-align: center; }
.hb-cal-g .d { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: .74rem; font-weight: 800; color: var(--ink-3); cursor: default; }
.hb-cal-g .d.l0 { background: transparent; }
.hb-cal-g .d.l1 { background: var(--hm1); color: var(--navy); } .hb-cal-g .d.l2 { background: var(--hm2); color: #fff; }
.hb-cal-g .d.l3 { background: var(--hm3); color: #fff; } .hb-cal-g .d.l4 { background: var(--hm4); color: #fff; }
.hb-cal-g .d.today { outline: 2.5px solid var(--hb-hat); outline-offset: 1px; color: var(--navy); }
.hb-cal-g .d.future { opacity: .35; }
.hb-cal-g .d:not(.future):hover { box-shadow: 0 0 0 2px var(--hb-hat); }

/* km tile (app.js hbRoad / hbRank): 1 study day = 1 km, road from the last milestone to the next, highest game title ×N.
   Road colours = the racetrack's tokens (guide.css). Design D of graphics/streak_km_options.html. */
.hb-streak { display: grid; justify-items: center; align-content: center; gap: 6px; text-align: center; background: linear-gradient(0deg, var(--grass), var(--panel) 70%); }
.hb-streak .n { font-size: 2.8rem; font-weight: 900; color: var(--navy); line-height: 1; font-variant-numeric: tabular-nums; }
.hb-streak .n small { font-size: 1.1rem; margin-left: 4px; color: var(--ink-2); }
.hb-streak > b { color: var(--navy); }
.hb-road { width: 100%; max-width: 270px; }
.hb-road svg { display: block; width: 100%; height: auto; }
.hb-rk1, .hb-rk2, .hb-rd, .hb-rdone, .hb-rc { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hb-rk1 { stroke: var(--kerb); stroke-width: 34; }
.hb-rk2 { stroke: var(--kerb-2); stroke-width: 34; stroke-dasharray: 10 10; stroke-linecap: butt; }
.hb-rd { stroke: var(--asphalt); stroke-width: 27; }
.hb-rdone { stroke: var(--accent); stroke-opacity: .8; stroke-width: 27; }
.hb-rc { stroke: #fff; stroke-opacity: .7; stroke-width: 2; stroke-dasharray: 10 9; animation: hbFlow 1.2s linear infinite; }
@keyframes hbFlow { to { stroke-dashoffset: -19; } }
.hb-sign rect { fill: var(--panel); stroke: var(--navy); stroke-width: 2; }
.hb-sign.goal rect { fill: var(--hb-hat); }
.hb-sign text { font: 900 13.5px var(--f-body, "Nunito", sans-serif); fill: var(--navy); text-anchor: middle; }
.hb-sign.goal text { fill: var(--hb-hat-ink); }
.hb-sign line { stroke: var(--navy); stroke-width: 2.5; }
.hb-kb { animation: hbBump 1s ease-in-out infinite alternate; }
@keyframes hbBump { to { transform: translateY(-2px); } }
.hb-mbar { width: 86%; height: 10px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.hb-mbar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.hb-rank { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel-2); border-radius: 14px; padding: 6px 10px; text-align: left; cursor: default; }
.hb-rank > span:first-child { flex: none; display: grid; }
.hb-rank > div { display: grid; min-width: 0; }
.hb-rank b { color: var(--navy); font-size: .9rem; line-height: 1.2; }
.hb-rank small { font-weight: 800; font-size: .74rem; }
.hb-rank .x { font-size: 1.3rem; font-weight: 900; margin-left: auto; color: var(--navy); }
.hb-rank .m0 { color: var(--ink-3); } .hb-rank .m1 { color: #b8682c; } .hb-rank .m2 { color: #7f8ea3; } .hb-rank .m3 { color: #c08a00; } .hb-rank .m4 { color: #7a5ce0; }
.hb-rays { animation: hbSpin 18s linear infinite; transform-origin: 60px 60px; }
@keyframes hbSpin { to { transform: rotate(360deg); } }
.hb-shine { animation: hbShine 3.2s ease-in-out infinite; }
@keyframes hbShine { 0%, 55% { transform: translateX(-90px); } 100% { transform: translateX(120px); } }
.hb-glow { animation: hbGlow 2.4s ease-in-out infinite alternate; transform-origin: 60px 60px; }
@keyframes hbGlow { from { opacity: .45; transform: scale(.94); } to { opacity: .9; transform: scale(1.06); } }
.hb-kmfoot { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.hb-kmfoot span { background: var(--panel-2); border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 800; color: var(--ink-2); }
.hb-kmfoot b { color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .hb-rc, .hb-kb, .hb-rays, .hb-shine, .hb-glow { animation: none; } }

/* lesson card (app.js lessonCard): a Polaroid, home page and 📚 Thư viện (.lb-tiles). Photo = graphics/lesson_art.js */
.hb-lesson { position: relative; display: flex; flex-direction: column; gap: 9px; background: var(--panel); padding: 12px 12px 14px; border-radius: 4px;
  box-shadow: var(--shadow), 0 1px 0 var(--line); transform: rotate(var(--tilt, 0deg)); transition: transform .2s, box-shadow .2s; cursor: pointer; margin: 14px 0 0; }
.hb-lesson:hover { transform: rotate(0deg) translateY(-4px); }
.hb-lesson:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }
.hb-lesson.current { box-shadow: 0 0 0 3px var(--hb-hat), var(--shadow); }
.hb-tape { position: absolute; top: -11px; left: 50%; width: 92px; height: 24px; transform: translateX(-50%) rotate(calc(var(--tilt, 0deg) * -2));
  background: var(--tape, #f7d77a); opacity: .8; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); pointer-events: none; }
.hb-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2px; }
.hb-photo svg.ill { display: block; width: 100%; height: 100%; transition: transform .35s; }
.hb-photo svg.ill .t { stroke-width: 2.2; }
.hb-lesson:hover .hb-photo svg.ill { transform: scale(1.05); }
.hb-ago { position: absolute; left: 8px; bottom: 8px; font-size: .72rem; font-weight: 700; background: rgba(255, 255, 255, .9); color: #1f3a68; border-radius: 6px; padding: 1px 7px; }
.hb-pct { position: absolute; right: 8px; bottom: 8px; font-size: .8rem; font-weight: 900; background: #1f2a44; color: #fff; border-radius: 999px; padding: 2px 9px; display: inline-flex; align-items: center; }
.hb-pct.done { background: var(--ok); }
.hb-pct svg.ic { width: 16px; height: 16px; margin: 0; --i-line: #fff; --i-fill: rgba(255, 255, 255, .3); --i-acc: #ffd66b; }
.hb-lesson .tag { font: 400 .9rem "Itim", "Nunito", sans-serif; color: var(--ink-2); }
.hb-lesson h3 { margin: -4px 0 0; font: 400 1.2rem/1.25 "Itim", "Nunito", sans-serif; color: var(--navy); }
.hb-lesson h3 mark { background: var(--hov-fill); color: inherit; border-radius: 3px; }
.hb-pbar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: auto; }
.hb-pbar i { display: block; height: 100%; border-radius: 4px; background: var(--navy); }
.hb-lnums { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--ink-2); }
.hb-lnums b { color: var(--navy); }
.hb-lact { position: relative; }
.hb-lesson.cr-locked .hb-photo { filter: grayscale(.7); opacity: .75; }
@media (prefers-reduced-motion: reduce) { .hb-lesson, .hb-photo svg.ill { transition: none; } .hb-lesson:hover { transform: rotate(var(--tilt, 0deg)); } }

/* goal tile */
.hb-goal { display: grid; gap: 10px; justify-items: center; align-content: start; text-align: center; }
.hb-gw { position: relative; width: 140px; height: 140px; }
.hb-gw > div { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; }
.hb-gw b { font-size: 2rem; color: var(--navy); font-weight: 900; line-height: 1; }

/* skills radar */
svg.hb-radar { display: block; width: 100%; max-width: 360px; height: auto; margin: 4px auto 0; overflow: visible; }
.hb-radar .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.hb-radar .lab { fill: var(--ink-2); font-size: 12px; font-weight: 700; }
.hb-radar .val { fill: var(--navy); font-size: 12px; font-weight: 900; }
.hb-radar .pass { fill: none; stroke: var(--hb-hat); stroke-width: 1.5; stroke-dasharray: 4 4; }
.hb-radar .area { fill: var(--accent); fill-opacity: .25; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.hb-radar .dot { fill: var(--accent); stroke: var(--panel); stroke-width: 1.5; }
.hb-radar .dot.weak { fill: var(--bad); }

/* mastery donut */
.hb-mastery { display: grid; grid-template-rows: auto 1fr; gap: 14px; }
/* sized to match the radar beside it now that the tile holds only the donut */
.hb-donut { display: flex; justify-content: center; align-items: center; gap: 20px 40px; flex-wrap: wrap; }
.hb-dw { position: relative; width: min(260px, 100%); aspect-ratio: 1; flex: none; }
.hb-dw svg { width: 100%; height: 100%; display: block; }
.hb-dw > div { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; }
.hb-dw b { font-size: 2.4rem; color: var(--navy); font-weight: 900; line-height: 1.1; }
.hb-dw .small { font-size: .95rem; }
.hb-dleg { display: grid; gap: 12px; font-size: 1rem; }
.hb-dleg i { display: inline-block; width: 14px; height: 14px; border-radius: 5px; margin-right: 8px; vertical-align: -2px; border: 1px solid var(--line); }
.hb-dleg b { color: var(--navy); font-variant-numeric: tabular-nums; }

/* badges: study (hexagons) + game titles (shields of games.js ttBadge) */
.hb-sub { margin: 14px 0 8px; font-size: .9rem; color: var(--ink-2); }
.hb-hexes { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
.hb-hex { display: grid; justify-items: center; gap: 4px; text-align: center; font-size: .74rem; font-weight: 700; color: var(--ink-2); cursor: default; }
.hb-hex .hx { width: 60px; height: 66px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--hb-hat); display: grid; place-items: center; }
.hb-hex .in { width: 52px; height: 58px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--hb-hat-soft); display: grid; place-items: center; }
.hb-hex .in svg.ic { width: 28px; height: 28px; margin: 0; }
.hb-hex.off .hx { background: var(--line); } .hb-hex.off .in { background: var(--panel-2); filter: grayscale(1); opacity: .6; }
.hb-hex .p { height: 5px; width: 54px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.hb-hex .p i { display: block; height: 100%; background: var(--accent); }
.hb-games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hb-game { background: var(--panel-2); border-radius: 16px; padding: 10px 12px; display: grid; gap: 8px; min-width: 0; }
.hb-gname { border: 0; background: none; padding: 0; font: inherit; font-weight: 900; color: var(--navy); display: flex; align-items: center; gap: 6px; cursor: pointer; justify-self: start; }
.hb-gname:hover { color: var(--accent); }
.hb-gname svg.ic { width: 24px; height: 24px; margin: 0; }
.hb-shields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.hb-shield { display: grid; justify-items: center; gap: 3px; text-align: center; font-size: .7rem; font-weight: 800; color: var(--ink-2); line-height: 1.2; cursor: default; }
.hb-shield.off { color: var(--ink-3); font-weight: 700; }

.hb-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--navy); color: var(--bg); padding: 6px 10px; border-radius: 10px; font-size: .8rem; font-weight: 700; line-height: 1.4; transform: translate(-50%, -100%); max-width: 320px; }

@media (max-width: 1100px) { .hb-games { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .hb-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hb-s3, .hb-s4 { grid-column: span 2; }
  .hb-cals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hb-cals > :first-child { display: none; }
}
@media (max-width: 560px) {
  .hb-bento { grid-template-columns: 1fr; } .hb-s2, .hb-s3, .hb-s4 { grid-column: span 1; }
  .hb-cals { grid-template-columns: 1fr; }
}
/* dark theme: the top greens are light, so their day numbers turn dark */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hb-cal-g .d.l3, :root:not([data-theme="light"]) .hb-cal-g .d.l4 { color: #062520; } }
:root[data-theme="dark"] .hb-cal-g .d.l3, :root[data-theme="dark"] .hb-cal-g .d.l4 { color: #062520; }
