/* Góc nhỏ của con — giao diện nhiều màu, vui tươi */
:root {
  --bg: #FFF7EC;
  --surface: #FFFFFF;
  --surface-2: #FFF1E2;
  --ink: #3B2B4F;
  --ink-2: #6E6180;
  --ink-3: #9A8FA8;
  --line: #F1E3D3;
  --coral: #FF7B54;
  --coral-dark: #E85F38;
  --sun: #FFC23C;
  --mint: #2EC4B6;
  --sky: #4D96FF;
  --grape: #9B5DE5;
  --pink: #FF6FA5;
  --danger: #E5484D;
  --ok: #1FA67A;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 2px 0 rgba(59, 43, 79, .04), 0 10px 30px -12px rgba(59, 43, 79, .18);
  --shadow-lift: 0 2px 0 rgba(59, 43, 79, .05), 0 18px 40px -14px rgba(59, 43, 79, .28);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 194, 60, .22) 0 90px, transparent 91px),
    radial-gradient(circle at 92% 18%, rgba(77, 150, 255, .14) 0 120px, transparent 121px),
    radial-gradient(circle at 80% 92%, rgba(255, 111, 165, .12) 0 140px, transparent 141px),
    radial-gradient(circle at 4% 70%, rgba(46, 196, 182, .12) 0 110px, transparent 111px);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 10px; }

/* ---------- khung chính ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--ink-2); font-weight: 700; }
.boot img { animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 247, 236, .88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(241, 227, 211, .8);
}
.topbar-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 21px; color: var(--ink); white-space: nowrap; }
.brand img { width: 38px; height: 38px; }
.brand em { font-style: normal; color: var(--coral); }
.topnav { display: none; gap: 4px; margin-left: 8px; }
.topnav a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--ink-2); }
.topnav a svg { width: 20px; height: 20px; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a.active { background: var(--ink); color: #fff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-actions .btn-add-top { display: none; }

.view { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(110px + var(--safe-bottom)); }
.wrap { max-width: 760px; margin: 0 auto; }
.wrap.wide { max-width: 1120px; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 6px 8px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px -18px rgba(59, 43, 79, .35);
}
.bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 800; border-radius: 14px; min-width: 0; }
.bottombar a svg { width: 24px; height: 24px; }
.bottombar a.active { color: var(--coral); }
.bottombar a.active svg { transform: translateY(-1px); }
.bottombar .fab { flex: 0 0 auto; width: 62px; height: 62px; margin: -26px 6px 0; border-radius: 22px; background: linear-gradient(135deg, var(--coral), var(--pink)); color: #fff; justify-content: center; box-shadow: 0 10px 22px -8px rgba(255, 123, 84, .8); transform: rotate(-4deg); }
.bottombar .fab svg { width: 30px; height: 30px; }
.bottombar .fab.active { color: #fff; }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .top-actions .btn-add-top { display: inline-flex; }
  .bottombar { display: none; }
  .view { padding: 28px 24px 60px; }
}

/* ---------- nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 0;
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
  background: var(--surface-2); color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 6px 0 var(--coral-dark); }
.btn-primary:hover { background: #FF8A66; }
.btn-primary:active { box-shadow: 0 3px 0 var(--coral-dark); transform: translateY(3px); }
.btn-ghost { background: transparent; border: 2px solid var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: #FFE8E8; color: var(--danger); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 14px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.active { background: var(--ink); color: #fff; }
.icon-btn svg { width: 24px; height: 24px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--coral-dark); font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- thẻ & chip ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 13.5px; font-weight: 800; line-height: 1.4;
  background: color-mix(in srgb, var(--c, var(--coral)) 16%, white);
  color: color-mix(in srgb, var(--c, var(--coral)) 72%, var(--ink));
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.chip-tag { --c: var(--ink-3); background: var(--surface-2); color: var(--ink-2); font-weight: 700; text-decoration: none; }
a.chip-tag:hover { background: var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* chip chọn được (bộ lọc, form) */
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button, .pick label {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 8px 16px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface);
  font-weight: 800; font-size: 15px; cursor: pointer; color: var(--ink-2);
  transition: all .12s ease;
}
.pick button:hover, .pick label:hover { border-color: color-mix(in srgb, var(--c, var(--coral)) 50%, white); }
.pick button[aria-pressed="true"], .pick label:has(input:checked) {
  background: var(--c, var(--coral)); border-color: var(--c, var(--coral)); color: #fff;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c, var(--coral)) 70%, black);
}
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .emo { font-size: 18px; line-height: 1; }

.avatar {
  --size: 44px;
  width: var(--size); height: var(--size); flex: 0 0 auto;
  border-radius: 38%; overflow: hidden;
  display: grid; place-items: center;
  background: var(--c, var(--coral)); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: calc(var(--size) * .45);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px color-mix(in srgb, var(--c, var(--coral)) 35%, white);
}
/* Ảnh đại diện luôn lấp đầy khung vuông bo góc, cắt phần thừa (kể cả ảnh cũ chưa được cắt). */
.avatar { position: relative; }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center 30%; border-radius: inherit; }

/* ---------- tiêu đề trang ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head .sub { color: var(--ink-2); margin: 2px 0 0; font-weight: 600; }
.page-head .grow { flex: 1; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 800; text-decoration: none; margin-bottom: 10px; }
.back svg { width: 20px; height: 20px; }

/* ---------- đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; text-align: center; padding: 34px 26px 28px; position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 8px; background: linear-gradient(90deg, var(--coral), var(--sun), var(--mint), var(--sky), var(--grape), var(--pink)); }
.login-card img { margin: 0 auto 14px; width: 84px; height: 84px; animation: bob 3s ease-in-out infinite; }
.login-card h1 { font-size: 32px; }
.login-card h1 em { font-style: normal; color: var(--coral); }
.login-card p { color: var(--ink-2); margin: 6px 0 22px; }
.login-card form { display: grid; gap: 14px; text-align: left; }
.login-note { font-size: 14px; color: var(--ink-3); margin-top: 18px !important; margin-bottom: 0 !important; }

/* ---------- form ---------- */
.field { display: grid; gap: 6px; }
.field > span, .field-label { font-weight: 800; font-size: 15px; color: var(--ink); }
.field small, .hint { color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
.input, textarea.input, select.input {
  width: 100%; min-height: 48px; padding: 12px 16px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--surface);
  font-size: 16px; outline: none; transition: border-color .12s ease, box-shadow .12s ease;
}
textarea.input { min-height: 130px; resize: vertical; line-height: 1.55; }
.input:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(77, 150, 255, .18); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 54px; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 2px; }
.form-grid { display: grid; gap: 20px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.form-actions .spacer { flex: 1; }
.error-text { color: var(--danger); font-weight: 700; font-size: 14.5px; margin: 0; }

.switch { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface-2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { flex: 0 0 auto; width: 54px; height: 32px; border-radius: 999px; background: #D9CEC2; position: relative; transition: background .15s ease; margin-top: 2px; }
.switch .track::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .15s ease; }
.switch input:checked + .track { background: var(--mint); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--sky); outline-offset: 2px; }
.switch b { display: block; }
.switch small { color: var(--ink-2); font-weight: 600; }

/* ---------- ảnh trong form ---------- */
.photo-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo-pick .ph { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.photo-pick .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick .ph .rm { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(59, 43, 79, .78); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.photo-pick .ph .first { position: absolute; left: 6px; bottom: 6px; background: rgba(255,255,255,.92); color: var(--ink); font-size: 11.5px; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.photo-pick .ph .mv { position: absolute; left: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--ink); cursor: pointer; display: grid; place-items: center; font-weight: 800; }
.photo-pick .ph.loading::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .55); }
.photo-pick .ph.loading .spin { position: absolute; inset: 0; margin: auto; z-index: 1; }
.photo-pick .ph.err { outline: 3px solid var(--danger); }
.photo-add { aspect-ratio: 1; border-radius: 16px; border: 2.5px dashed color-mix(in srgb, var(--coral) 45%, white); background: color-mix(in srgb, var(--coral) 6%, white); color: var(--coral-dark); font-weight: 800; font-size: 14px; display: grid; place-content: center; justify-items: center; gap: 4px; cursor: pointer; text-align: center; padding: 6px; }
.photo-add svg { width: 30px; height: 30px; }
.photo-add:hover { background: color-mix(in srgb, var(--coral) 12%, white); }

.spin { width: 28px; height: 28px; border-radius: 50%; border: 3.5px solid rgba(255, 123, 84, .25); border-top-color: var(--coral); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); min-height: 50px; }
.tag-input:focus-within { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(77, 150, 255, .18); }
.tag-input input { border: 0; outline: none; flex: 1; min-width: 120px; padding: 6px; background: transparent; font-size: 16px; }
.tag-input .chip button { border: 0; background: none; cursor: pointer; padding: 0 0 0 2px; color: inherit; font-size: 15px; line-height: 1; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-suggest button { border: 0; cursor: pointer; }

/* ---------- dòng thời gian ---------- */
.hello { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 20px; background: linear-gradient(135deg, #FFE3D3, #FFF1C9 55%, #DFF7F0); border-radius: var(--radius); position: relative; overflow: hidden; }
.hello::after { content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.hello .avatar { --size: 62px; }
.hello h1 { font-size: 24px; }
.hello p { margin: 2px 0 0; color: var(--ink-2); font-weight: 700; }
.hello .grow { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hello .btn { position: relative; z-index: 1; }
.hello-kids { display: flex; }
@media (max-width: 560px) {
  .hello { flex-wrap: wrap; }
  .hello .grow { flex-basis: calc(100% - 80px); }
  .hello .btn { width: 100%; }
}
.hello-kids .avatar + .avatar { margin-left: -12px; }

.kid-filter { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 6px; scrollbar-width: none; }
.kid-filter::-webkit-scrollbar { display: none; }
.kid-filter a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--surface); border: 2px solid var(--line); text-decoration: none; font-weight: 800; white-space: nowrap; color: var(--ink-2); }
.kid-filter a.all { padding-left: 14px; }
.kid-filter a .avatar { --size: 30px; box-shadow: none; }
.kid-filter a.active { border-color: var(--c, var(--ink)); background: color-mix(in srgb, var(--c, var(--ink)) 12%, white); color: var(--ink); }

.otd { margin-bottom: 26px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 21px; margin: 0 0 12px; }
.section-title .emo { font-size: 24px; }
.otd-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; }
.otd-card { flex: 0 0 min(78%, 300px); scroll-snap-align: start; text-decoration: none; background: var(--surface); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; border: 3px solid var(--sun); }
.otd-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.otd-card .otd-body { padding: 10px 14px 14px; }
.otd-card .ago { display: inline-block; background: var(--sun); color: var(--ink); font-weight: 800; font-size: 13px; padding: 2px 10px; border-radius: 999px; }
.otd-card p { margin: 6px 0 0; color: var(--ink-2); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.month { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--ink); }
.month::after { content: ''; flex: 1; height: 3px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 16px); }
.month:first-child { margin-top: 4px; }

.feed { display: grid; gap: 18px; }
.feed > .month { margin: 10px 0 -4px; }
.feed > .month:first-child { margin-top: 0; }
/* Thẻ kỷ niệm gọn: ảnh nhỏ bên trái, chữ bên phải */
.entry-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); position: relative; padding: 10px 12px 10px 14px; overflow: hidden; }
.entry-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent, var(--coral)); }
.ec-media { flex: 0 0 auto; width: 96px; height: 96px; border-radius: 14px; overflow: hidden; position: relative; background: var(--surface-2); display: block; }
.ec-media img { width: 100%; height: 100%; object-fit: cover; }
.ec-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ec-main { display: grid; gap: 4px; text-decoration: none; color: inherit; min-width: 0; }
.ec-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; }
.ec-meta .entry-date { font-size: 13px; }
.ec-kid { font-weight: 800; color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.ec-kid small { font-weight: 700; color: var(--ink-3); font-size: 12.5px; }
.ec-cats { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; }
.ec-cats em { font-style: normal; font-size: 12.5px; font-weight: 800; color: var(--ink-2); margin-left: 3px; }
.entry-card h3 { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.entry-card .entry-note { -webkit-line-clamp: 2; font-size: 15px; color: var(--ink-2); overflow-wrap: anywhere; }
.entry-card.open .entry-note { -webkit-line-clamp: unset; display: block; }
.more-note { justify-self: start; font-size: 14px; min-height: 32px; padding: 4px 0; }
.entry-card .entry-foot { font-size: 13px; gap: 10px; }
.entry-card .entry-foot .st.tag { font-weight: 700; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-card:hover { box-shadow: var(--shadow-lift); }
@media (min-width: 640px) {
  .entry-card { padding: 14px 16px 14px 18px; gap: 16px; }
  .ec-media { width: 150px; height: 150px; }
  .entry-card h3 { font-size: 19px; }
  .entry-card .entry-note { -webkit-line-clamp: 3; }
}
.feed { gap: 12px; }

/* ô ảnh/video thu nhỏ dùng chung */
.play-badge { position: absolute; inset: 0; margin: auto; width: 40px; height: 40px; border-radius: 50%; background: rgba(43, 34, 54, .72); color: #fff; display: grid; place-items: center; font-size: 16px; padding-left: 3px; box-shadow: 0 0 0 3px rgba(255,255,255,.75); pointer-events: none; }
.dur-badge { position: absolute; right: 6px; bottom: 6px; background: rgba(43, 34, 54, .78); color: #fff; font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 999px; pointer-events: none; }
.more-badge { position: absolute; left: 6px; bottom: 6px; background: rgba(255,255,255,.92); color: var(--ink); font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.vid-blank { position: absolute; inset: 0; background: linear-gradient(135deg, #3B2B4F, #6E4FA0); }
img.broken { visibility: hidden; }

.entry-body { padding: 16px 18px 16px 24px; display: grid; gap: 10px; }
.entry-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entry-date { font-weight: 800; color: var(--ink-2); font-size: 14.5px; }
.entry-card h3 { font-size: 20px; }
.entry-note { margin: 0; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.entry-foot { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.entry-foot .sep { flex: 1; }
.entry-foot .st { display: inline-flex; align-items: center; gap: 4px; }
.entry-foot .st svg { width: 17px; height: 17px; }
.st.shared { color: var(--ok); }

.collage { display: grid; gap: 3px; background: var(--surface); }
.collage img { width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }
.collage.n1 img { max-height: 520px; aspect-ratio: auto; }
.collage.n1 .one { aspect-ratio: var(--ar, 4 / 3); max-height: 520px; overflow: hidden; }
.collage.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1.1; }
.collage.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.collage.n3 > :first-child { grid-row: span 2; }
.collage.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / .8; }
.collage > div { position: relative; overflow: hidden; min-height: 0; }
.collage .more { position: absolute; inset: 0; background: rgba(59, 43, 79, .55); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-size: 30px; font-weight: 800; }

.empty { text-align: center; padding: 40px 20px; }
.empty .big { font-size: 56px; line-height: 1; margin-bottom: 12px; }
.empty h2 { font-size: 24px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); margin: 0 auto 18px; max-width: 420px; }
.more-wrap { display: flex; justify-content: center; padding: 22px 0 0; }
.loading-row { display: flex; justify-content: center; padding: 30px; }

/* ---------- trang chi tiết ---------- */
.detail { padding: 0; overflow: hidden; }
.detail .gallery { display: grid; gap: 4px; }
.detail .gallery button { border: 0; padding: 0; cursor: zoom-in; background: var(--surface-2); display: block; width: 100%; }
.detail .gallery img { width: 100%; max-height: 640px; object-fit: contain; background: #2B2236; }
.detail .gallery.many { grid-template-columns: 1fr 1fr; }
.detail .gallery.many img { aspect-ratio: 1; object-fit: cover; max-height: none; }
.detail .gallery.many button:first-child { grid-column: span 2; }
.detail .gallery.many button:first-child img { aspect-ratio: 4 / 3; }
.detail-body { padding: 20px 22px 24px; display: grid; gap: 14px; }
.detail-body h1 { font-size: 28px; }
.detail-note { white-space: pre-line; font-size: 17px; margin: 0; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.share-box { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--surface-2); flex-wrap: wrap; }
.share-box .grow { flex: 1; min-width: 180px; font-weight: 700; }
.share-box.on { background: color-mix(in srgb, var(--mint) 14%, white); }

.comments { margin-top: 22px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .avatar { --size: 40px; --c: var(--grape); box-shadow: none; font-size: 17px; }
.comment .grow { flex: 1; min-width: 0; }
.comment .who { font-weight: 800; }
.comment .when { color: var(--ink-3); font-size: 13px; font-weight: 700; margin-left: 6px; }
.comment p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.comment-form { display: grid; gap: 10px; margin-top: 14px; }
.comment-form textarea { min-height: 84px; }

/* ---------- lưới ảnh ---------- */
.grid-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid-photos button { border: 0; padding: 0; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); cursor: zoom-in; border-radius: 6px; }
.grid-photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.grid-photos button:hover img { transform: scale(1.04); }
@media (min-width: 640px) { .grid-photos { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 900px) { .grid-photos { grid-template-columns: repeat(6, 1fr); } .grid-photos button { border-radius: 10px; } }

/* ---------- tìm kiếm ---------- */
.search-box { position: relative; margin-bottom: 14px; }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--ink-3); }
.search-box .input { padding-left: 50px; min-height: 54px; font-size: 17px; border-radius: 999px; }
.filter-block { margin-bottom: 14px; }
.filter-block .field-label { display: block; margin-bottom: 8px; }
.result-count { color: var(--ink-2); font-weight: 700; margin: 18px 0 10px; }

/* ---------- hồ sơ bé ---------- */
.kids-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.kid-card { display: flex; align-items: center; gap: 16px; text-decoration: none; padding: 20px; border-top: 6px solid var(--c, var(--coral)); }
.kid-card .avatar { --size: 70px; }
.kid-card h2 { font-size: 23px; }
.kid-card p { margin: 0; color: var(--ink-2); font-weight: 700; }
.kid-add { display: grid; place-content: center; justify-items: center; gap: 6px; min-height: 120px; border: 3px dashed var(--line); border-radius: var(--radius); background: transparent; cursor: pointer; font-weight: 800; color: var(--ink-2); font-size: 16px; }
.kid-add:hover { border-color: var(--coral); color: var(--coral-dark); }
.kid-add svg { width: 34px; height: 34px; }

.kid-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 22px; margin-bottom: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, white), color-mix(in srgb, var(--c) 6%, white)); border-radius: var(--radius); }
.kid-hero .avatar { --size: 96px; cursor: pointer; position: relative; border: 0; padding: 0; }
.kid-hero .avatar .cam { position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow); }
.kid-hero .avatar .cam svg { width: 18px; height: 18px; }
.kid-hero .avatar { overflow: visible; }
.kid-hero .avatar > img { border-radius: 38%; }
.kid-hero .avatar .cam { z-index: 1; }
.kid-hero h1 { font-size: 32px; }
.kid-hero p { margin: 2px 0 0; font-weight: 700; color: var(--ink-2); }
.kid-hero .grow { flex: 1; min-width: 200px; }
.kid-hero .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.profile-sections { display: grid; gap: 18px; }
@media (min-width: 1000px) { .profile-sections { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.psec { padding: 18px; border-top: 6px solid var(--c); }
.psec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.psec-head .emo { font-size: 26px; }
.psec-head h2 { font-size: 20px; flex: 1; }
.psec .hint { margin: 0 0 12px; }
.pitems { display: grid; gap: 8px; }
.pitem { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--c) 9%, white); border: 0; text-align: left; width: 100%; cursor: pointer; }
.pitem:hover { background: color-mix(in srgb, var(--c) 16%, white); }
.pitem .grow { flex: 1; min-width: 0; }
.pitem b { display: block; font-weight: 800; overflow-wrap: anywhere; }
.pitem small { display: block; color: var(--ink-2); font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.pitem .when { color: var(--ink-3); font-size: 12.5px; font-weight: 700; }
.pitem.past { background: var(--surface-2); opacity: .85; }
.past-toggle { margin-top: 10px; }
.psec .btn { margin-top: 12px; }

/* ---------- cài đặt ---------- */
.settings { display: grid; gap: 18px; }
.settings h2 { font-size: 21px; margin-bottom: 4px; }
.settings p { margin: 0 0 14px; color: var(--ink-2); }
.meter { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.meter > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--sky)); min-width: 6px; }
.progress-text { font-weight: 700; color: var(--ink-2); margin-top: 10px !important; }

/* ---------- hộp thoại ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(43, 34, 54, .45); display: flex; align-items: flex-end; justify-content: center; padding: 0; animation: fade .15s ease; }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 22px 20px calc(20px + var(--safe-bottom)); animation: up .2s ease; }
.modal h2 { font-size: 24px; margin-bottom: 8px; }
.modal > p { color: var(--ink-2); margin: 0 0 16px; }
.modal .form-actions { margin-top: 20px; }
@media (min-width: 640px) { .modal-back { align-items: center; padding: 20px; } .modal { border-radius: 26px; padding: 26px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches label { width: 42px; height: 42px; border-radius: 14px; background: var(--c); cursor: pointer; position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--c); }
.swatches label:has(input:focus-visible) { outline: 3px solid var(--sky); outline-offset: 4px; }

/* ---------- xem ảnh lớn ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(20, 14, 28, .94); display: flex; flex-direction: column; animation: fade .15s ease; touch-action: pan-y; }
.lightbox .lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; }
.lightbox .lb-top .grow { flex: 1; font-weight: 800; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.lightbox .lb-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 8px; position: relative; }
.lightbox .lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-drag: none; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox .lb-nav svg { width: 28px; height: 28px; }
.lightbox .lb-prev { left: 12px; }
.lightbox .lb-next { right: 12px; }
.lightbox .lb-bottom { padding: 12px 16px calc(16px + var(--safe-bottom)); display: flex; justify-content: center; }
.lightbox .lb-bottom .btn { background: rgba(255,255,255,.14); color: #fff; }

/* ---------- thông báo nhỏ ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(96px + var(--safe-bottom)); z-index: 100; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 700; box-shadow: var(--shadow-lift); max-width: 480px; animation: up .2s ease; pointer-events: auto; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@media (min-width: 900px) { #toasts { bottom: 28px; } }

/* ---------- video ---------- */
.lightbox .lb-stage video { max-width: 100%; max-height: 100%; border-radius: 8px; background: #000; }
.video-box { position: relative; background: #1E1628; }
.video-box video { display: block; width: 100%; max-height: 70vh; background: #000; }
.video-box .dur-badge { top: 10px; right: 10px; bottom: auto; }
.grid-photos button { position: relative; }
.otd-media { display: block; position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.otd-media img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto; }

/* ô video trong khung viết */
.photo-pick .ph .ph-state { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 8px; text-align: center; font-size: 12.5px; font-weight: 800; color: var(--ink); background: rgba(255, 255, 255, .72); }
.photo-pick .ph .ph-state .spin { position: static; width: 24px; height: 24px; }
.photo-pick .ph .ph-state small { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.photo-pick .ph .ph-state.warn { background: rgba(255, 240, 240, .88); color: var(--danger); }
.photo-pick .ph .ph-state .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; box-shadow: none; }
.photo-pick .ph .bar { width: 80%; height: 6px; border-radius: 6px; background: rgba(59, 43, 79, .15); overflow: hidden; }
.photo-pick .ph .bar i { display: block; height: 100%; background: var(--mint); transition: width .2s ease; }
.photo-pick .ph.loading::after { display: none; }
.photo-pick .ph .rm { z-index: 2; }
.photo-pick .ph .first.ok { background: var(--ok); color: #fff; }
.photo-add.video { border-color: color-mix(in srgb, var(--grape) 45%, white); background: color-mix(in srgb, var(--grape) 6%, white); color: var(--grape); }
.photo-add.video:hover { background: color-mix(in srgb, var(--grape) 12%, white); }
.photo-add span { line-height: 1.25; }
.save-status { margin: 4px 0 0; color: var(--ok); font-weight: 700; font-size: 13.5px; min-height: 1em; }

/* ---------- bộ lọc trên Nhật ký ---------- */
.tl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.filter-btn { min-height: 44px; }
.filter-btn.on { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 10%, white); color: var(--ink); }
.tl-tools .chips button { border: 0; cursor: pointer; min-height: 32px; }
.filter-panel { margin-bottom: 16px; padding: 16px; }
.filter-panel .pick button { min-height: 40px; padding: 6px 14px; font-size: 14.5px; }
.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; margin-top: 10px; }
.date-range .btn { grid-column: 1 / -1; justify-self: start; }

/* ---------- cắt ảnh đại diện ---------- */
.crop-stage { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto 14px; border-radius: 22px; overflow: hidden; background: var(--surface-2); touch-action: none; }
.crop-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-ring { position: absolute; inset: 0; pointer-events: none; border-radius: 38%; box-shadow: 0 0 0 999px rgba(43, 34, 54, .45); outline: 3px solid #fff; }
.crop-zoom input { width: 100%; accent-color: var(--coral); }
