/* Giao diện chung của Học viện Dữ liệu: phong cách hoạt hình, viền đậm, bóng cứng */
:root {
  --nen: #FFF6E4; --nen2: #FFECC7; --muc: #1F1B3A; --mo: #6B6785; --trang: #fff;
  --xanh: #3DA5F4; --vang: #FFC93C; --hong: #FF6B9D; --la: #3ECF8E; --tim: #8B6CF6; --cam: #FF8A3D; --do: #F25C54;
  --vien: 3px solid var(--muc); --bong: 5px 5px 0 var(--muc); --bo: 18px;
  --chu: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI", system-ui, sans-serif;
  --ma: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--chu); color: var(--muc); font-size: 16px; line-height: 1.55;
  background: var(--nen) radial-gradient(circle, rgba(31, 27, 58, .09) 1.2px, transparent 1.3px) 0 0 / 22px 22px;
  min-height: 100vh; overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0 0 .7em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Thanh điều hướng */
.thanh-tren {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--trang); border-bottom: var(--vien); overflow-x: auto; scrollbar-width: none;
}
.thanh-tren::-webkit-scrollbar { display: none; }
.thanh-tren .ten-hv { font-weight: 900; font-size: 18px; white-space: nowrap; text-decoration: none; margin-right: 6px; display: flex; align-items: center; gap: 6px; }
.thanh-tren .ten-hv svg { width: 34px; height: 36px; }
.thanh-tren a.muc {
  white-space: nowrap; text-decoration: none; font-weight: 700; font-size: 14px; padding: 6px 12px;
  border: 2.5px solid var(--muc); border-radius: 999px; background: var(--nen); transition: transform .15s, background .15s, box-shadow .15s;
}
.thanh-tren a.muc:hover { transform: translateY(-2px); box-shadow: 3px 3px 0 var(--muc); background: var(--vang); }
.thanh-tren a.muc.dang { background: var(--muc); color: var(--trang); }

/* Khung trang */
.khung-trang { max-width: 1240px; margin: 0 auto; padding: 22px 16px 140px; }
.dau-trang { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dau-trang h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 900; }
.dau-trang p { color: var(--mo); margin: 6px 0 0; max-width: 62ch; font-weight: 600; }

/* Thẻ, nút, nhãn */
.the { background: var(--trang); border: var(--vien); border-radius: var(--bo); box-shadow: var(--bong); padding: 16px; }
.the h2 { font-size: 20px; font-weight: 900; margin-bottom: 10px; }
.the h3 { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.nut {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 800; font-size: 15px; text-decoration: none;
  padding: 9px 16px; border: var(--vien); border-radius: 14px; background: var(--vang); box-shadow: 4px 4px 0 var(--muc);
  transition: transform .12s, box-shadow .12s, background .15s; white-space: nowrap;
}
.nut:hover { transform: translate(-1px, -2px); box-shadow: 6px 7px 0 var(--muc); }
.nut:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--muc); }
.nut:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 var(--muc); }
.nut.xanh { background: var(--xanh); } .nut.hong { background: var(--hong); } .nut.la { background: var(--la); }
.nut.tim { background: var(--tim); color: #fff; } .nut.trang { background: var(--trang); } .nut.do { background: var(--do); color: #fff; }
.nut.nho { padding: 5px 11px; font-size: 13px; border-width: 2.5px; box-shadow: 3px 3px 0 var(--muc); border-radius: 11px; }
.nut.chon { background: var(--muc); color: #fff; }
.nhan { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 9px; border: 2px solid var(--muc); border-radius: 999px; background: var(--nen2); white-space: nowrap; }
.hang { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.luoi2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.luoi2 > *, .bo-cuc > *, .bo-cuc > * > * { min-width: 0; }
.thanh-tren { scroll-margin-top: 0; } [id] { scroll-margin-top: 70px; }
@media (max-width: 860px) { .luoi2 { grid-template-columns: 1fr; } }
.o-nhap { border: var(--vien); border-radius: 12px; padding: 8px 12px; background: var(--trang); font-weight: 700; min-width: 0; }
.o-nhap:focus, textarea:focus { outline: 3px solid var(--xanh); outline-offset: 2px; }
.mo { color: var(--mo); font-weight: 600; font-size: 14px; }

/* Khối mã */
pre.ma {
  margin: 0; font-family: var(--ma); font-size: 13px; line-height: 1.6; background: #221E40; color: #F4F1FF;
  border: var(--vien); border-radius: 14px; padding: 12px 14px; overflow-x: auto; white-space: pre; tab-size: 2;
}
:is(pre.ma, .lenh, .ma-buoc) .tk { color: #FFC93C; font-weight: 700; } :is(pre.ma, .lenh, .ma-buoc) .ch { color: #7CF5D0; } :is(pre.ma, .lenh, .ma-buoc) .gc { color: #9A94C4; font-style: italic; } :is(pre.ma, .lenh, .ma-buoc) .so { color: #FF9EC0; }
.he { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 13px; padding: 3px 10px; border: 2.5px solid var(--muc); border-radius: 10px 10px 0 0; border-bottom: 0; margin-left: 12px; }
.he.my { background: #8EDCFF; } .he.or { background: #FFA48F; }

/* Bảng dữ liệu dạng lưới */
.bang { border: var(--vien); border-radius: 14px; overflow: hidden; background: var(--trang); font-size: 13.5px; }
.bang .dong { display: grid; border-top: 2px solid rgba(31, 27, 58, .12); }
.bang .dong > div { padding: 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bang .dong.dau { background: var(--muc); color: #fff; border-top: 0; }
.bang .dong.dau > div { font-weight: 800; font-family: var(--ma); font-size: 12.5px; }
.bang .rong { color: #B3AEC9; font-style: italic; }
.cuon-ngang { overflow-x: auto; }

/* Linh vật */
.linh-vat { position: fixed; right: 14px; bottom: 12px; z-index: 60; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; max-width: min(430px, calc(100vw - 28px)); }
.linh-vat .hinh { width: 88px; flex: none; animation: nhun 3.2s ease-in-out infinite; pointer-events: auto; cursor: pointer; filter: drop-shadow(3px 4px 0 rgba(31, 27, 58, .25)); }
.linh-vat .bong-noi {
  pointer-events: auto; background: var(--trang); border: var(--vien); border-radius: 18px 18px 4px 18px; padding: 10px 14px;
  font-weight: 700; font-size: 14px; box-shadow: var(--bong); margin-bottom: 34px; animation: bat .35s cubic-bezier(.3, 1.6, .5, 1);
}
.linh-vat .bong-noi:empty { display: none; }
.linh-vat .bong-noi b { color: #D6336C; }
.mat { transform-origin: center; transform-box: fill-box; animation: chop 4.5s infinite; }

@keyframes nhun { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes chop { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes bat { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes roi-vao { from { transform: translateY(-14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rung { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-1deg); } 40% { transform: translateX(8px) rotate(1deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes nhay { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 201, 60, .9); } 50% { box-shadow: 0 0 0 9px rgba(255, 201, 60, 0); } }
.rung { animation: rung .5s; }
.hat-giay { position: fixed; top: -20px; width: 11px; height: 16px; z-index: 99; border: 2px solid var(--muc); border-radius: 3px; pointer-events: none; animation: giay-roi linear forwards; }
@keyframes giay-roi { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
