/* ===================== TRANG CHỦ KIỂU INSTAGRAM (.ig-) ===================== */
.ig-root { height: 100%; background: var(--bg-elev); }
.ig-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.ig-col { max-width: 470px; margin: 0 auto; padding: 16px 12px 56px; }
.ig-col--wide { max-width: 935px; padding-top: 28px; }
.ig-top { display: flex; align-items: center; justify-content: space-between; padding: 0 0 12px; }
.ig-top h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
.ig-iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill); color: var(--text); transition: transform var(--dur-fast), background var(--dur-fast); }
.ig-iconbtn:hover { background: var(--hover); }
.ig-iconbtn:active { transform: scale(.9); }
.ig-iconbtn.is-liked { color: var(--danger); }
.ig-name { font-weight: 600; color: var(--text); }
.ig-name:hover { text-decoration: underline; }

/* ---------- Stories ---------- */
.ig-stories-wrap { border-bottom: 1px solid var(--border); margin: 0 -12px 12px; padding: 0 12px 14px; }
.ig-stories { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.ig-stories::-webkit-scrollbar { display: none; }
.ig-story { flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ig-story__av { position: relative; display: inline-grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; }
.ig-story__av.ig-ring { padding: 3px; }
.ig-story__name { max-width: 72px; font-size: var(--fs-xs); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-story__plus { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; border: 2px solid var(--bg-elev); }
.ig-story__av--plus { border: 1.5px dashed var(--border-strong); color: var(--text-2); }
.ig-ring { display: inline-flex; padding: 2px; border-radius: 50%; background: var(--brand-grad); }
.ig-ring.is-seen { background: var(--border-strong); }
.ig-ring .kit-avatar { box-shadow: 0 0 0 2px var(--bg-elev); }
.ig-plainav { display: inline-flex; border-radius: 50%; }

/* ---------- Bài đăng ---------- */
.ig-feed { display: flex; flex-direction: column; }
.ig-post { padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.ig-post__head { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ig-post__who { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.ig-post__who small { color: var(--text-3); display: inline-flex; align-items: center; gap: 2px; }
.ig-media { position: relative; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.ig-media__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ig-media__track::-webkit-scrollbar { display: none; }
.ig-media__slide { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 1 / 1; display: block; padding: 0; cursor: pointer; }
.ig-media__slide img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.ig-media__dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.ig-media__dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 0 2px rgba(0, 0, 0, .4); }
.ig-media__dots i.is-on { background: #fff; }
.ig-pop { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; opacity: 0; pointer-events: none; filter: drop-shadow(0 4px 16px rgba(0, 0, 0, .45)); }
.ig-pop.is-on { animation: ig-pop .8s var(--ease); }
@keyframes ig-pop { 0% { opacity: 0; transform: scale(.4); } 20% { opacity: 1; transform: scale(1.15); } 40% { transform: scale(.95); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
.ig-post__body { font-size: var(--fs-lg); line-height: 1.5; padding: 6px 0 4px; white-space: pre-wrap; word-break: break-word; }
.ig-actions { display: flex; gap: 2px; margin: 4px -8px 0; }
.ig-likes { font-weight: 600; margin: 2px 0 4px; }
.ig-caption { margin: 2px 0 4px; white-space: pre-wrap; word-break: break-word; }
.ig-comments { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-md); }
.ig-comment { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; word-break: break-word; }
.ig-cdel { color: var(--text-3); flex: none; margin-top: 3px; opacity: 0; }
.ig-comment:hover .ig-cdel, .ig-cdel:focus-visible { opacity: 1; }
.ig-more { color: var(--text-3); text-align: left; padding: 2px 0; }
.ig-crow { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ig-cinput { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); padding: 6px 0; font-size: var(--fs-md); }
.ig-cinput::placeholder { color: var(--text-3); }
.ig-csend { color: var(--accent); font-weight: 700; }
html:is([data-accent="classic"], [data-accent="tam"]) .ig-csend { color: #0095f6; }
.ig-empty { padding: 40px 0; }
.ig-empty__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Lưới ảnh (Khám phá, hồ sơ) ---------- */
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.ig-grid > .kit-empty { grid-column: 1 / -1; }
.ig-tile { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--surface-3); padding: 0; display: block; cursor: pointer; }
.ig-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-tile.is-text { background: var(--surface-2); display: grid; align-items: center; }
.ig-tile__text { padding: 12px; font-size: var(--fs-sm); text-align: left; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.ig-tile__multi { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.ig-tile__over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 20px; background: rgba(0, 0, 0, .38); color: #fff; opacity: 0; transition: opacity var(--dur-fast); }
.ig-tile__over b { display: inline-flex; align-items: center; gap: 5px; }
.ig-tile:hover .ig-tile__over, .ig-tile:focus-visible .ig-tile__over { opacity: 1; }

/* ---------- Trang cá nhân ---------- */
.ig-prof { display: flex; gap: 36px; align-items: flex-start; padding: 0 12px 28px; }
.ig-prof__av { flex: none; display: flex; justify-content: center; width: 150px; }
.ig-prof__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ig-prof__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ig-prof__row h2 { font-size: var(--fs-xl); font-weight: 500; margin-right: 6px; }
.ig-prof__stats { display: flex; gap: 28px; list-style: none; padding: 0; margin: 0; }
.ig-prof__tools { display: flex; gap: 2px; margin-left: -8px; }
.ig-prof__user { color: var(--text-3); }
.ig-prof__status { font-weight: 600; }
.ig-prof__bio { white-space: pre-wrap; color: var(--text); }
.ig-tabs { display: flex; justify-content: center; border-top: 1px solid var(--border); margin-bottom: 4px; }
.ig-tabs span { display: inline-flex; align-items: center; gap: 6px; padding: 14px 4px; margin-top: -1px; border-top: 1px solid var(--text); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Cửa sổ chi tiết bài ---------- */
.ig-detail-shell { width: min(480px, 96vw); }
.ig-detail-wrap { position: relative; }
.ig-detail { position: relative; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); padding: 4px 14px 10px; }
.ig-detail .ig-post { border-bottom: 0; margin-bottom: 0; }
.ig-detail__close { position: absolute; top: 10px; right: 10px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.ig-detail .ig-post__head { padding-right: 40px; }

/* ---------- Tạo bài / Tạo tin ---------- */
.ig-cp__wrap { display: flex; flex-direction: column; gap: 14px; }
.ig-cp__who { display: flex; align-items: center; gap: 10px; }
.ig-cp__thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.ig-cp__thumb, .ig-cp__add { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; }
.ig-cp__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ig-cp__thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .6); display: grid; place-items: center; }
.ig-cp__add { border: 1.5px dashed var(--border-strong); color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: var(--fs-xs); text-align: center; padding: 4px; }
.ig-cp__add:hover { background: var(--hover); }
.ig-cp__ta { width: 100%; resize: vertical; min-height: 96px; border: 0; outline: 0; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; color: var(--text); }
.ig-cp__vis { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.ig-sc__wrap { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.ig-sc__frame { position: relative; aspect-ratio: 9 / 16; max-height: 54vh; margin: 0 auto; width: auto; height: 54vh; max-width: 100%; border-radius: 12px; overflow: hidden; }
.ig-sc__preview { position: absolute; inset: 0; }
.ig-sc__preview img { width: 100%; height: 100%; object-fit: cover; }
.ig-sc__ta { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; outline: 0; resize: none; color: #fff; text-align: center; font-size: 22px; font-weight: 700; line-height: 1.3; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.ig-sc__ta::placeholder { color: rgba(255, 255, 255, .7); }
.ig-sc__frame:has(img) .ig-sc__ta { top: auto; bottom: 14px; transform: none; font-size: 16px; background: rgba(0, 0, 0, .45); border-radius: 8px; padding: 8px; }
.ig-sc__palette { display: flex; gap: 8px; justify-content: center; }
.ig-sc__dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg-elev); box-shadow: 0 0 0 1px var(--border-strong); }
.ig-sc__dot.is-on { box-shadow: 0 0 0 2px var(--text); }
.ig-sc__row { display: flex; justify-content: center; }
.ig-sc__pick { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); font-weight: 600; }
.ig-sc__pick:hover { background: var(--hover); }
[data-bg="0"] { background: linear-gradient(160deg, #4f6bff, #7c5cff 50%, #e056b0); }
[data-bg="1"] { background: linear-gradient(160deg, #8a6a47, #2b1d10); }
[data-bg="2"] { background: linear-gradient(160deg, #2a4d7a, #0b1626); }
[data-bg="3"] { background: linear-gradient(160deg, #7d2634, #25080d); }
[data-bg="4"] { background: linear-gradient(160deg, #2f5a3b, #0c1a11); }
[data-bg="5"] { background: linear-gradient(160deg, #f1e9d6, #cdbd9a); }
.ig-sc__dot[data-bg] { background-clip: padding-box; }
.ig-sc__frame [data-bg="5"] ~ .ig-sc__ta, .ig-sc__preview[data-bg="5"] ~ .ig-sc__ta { color: #1a1a1a; text-shadow: none; }

/* ---------- Trình xem story ---------- */
.ig-sv { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, .94); display: grid; place-items: center; }
.ig-sv__stage { position: relative; width: min(440px, 100vw); height: min(100dvh, 800px); background: #000; border-radius: 12px; overflow: hidden; color: #fff; user-select: none; }
.ig-sv__bars { position: absolute; top: 8px; left: 10px; right: 10px; z-index: 3; display: flex; gap: 4px; }
.ig-sv__bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.ig-sv__bar i { display: block; height: 100%; width: 0; background: #fff; }
.ig-sv__bar.is-done i { width: 100%; }
.ig-sv__bar:not(.is-done) i[style] { animation-name: ig-fill; animation-timing-function: linear; animation-fill-mode: forwards; }
.ig-sv__stage.is-paused .ig-sv__bar i { animation-play-state: paused; }
@keyframes ig-fill { from { width: 0; } to { width: 100%; } }
.ig-sv__head { position: absolute; top: 18px; left: 12px; right: 6px; z-index: 3; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.ig-sv__head small { opacity: .8; }
.ig-sv__sp { flex: 1; }
.ig-sv__btn { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; border-radius: 50%; }
.ig-sv__btn:hover { background: rgba(255, 255, 255, .15); }
.ig-sv__body { position: absolute; inset: 0; display: grid; place-items: center; }
.ig-sv__body img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ig-sv__text { position: absolute; left: 0; right: 0; padding: 0 28px; text-align: center; font-size: 26px; font-weight: 700; line-height: 1.3; word-break: break-word; }
.ig-sv__text.is-caption { top: auto; bottom: 64px; font-size: 16px; font-weight: 500; background: rgba(0, 0, 0, .5); margin: 0 14px; padding: 10px 12px; border-radius: 8px; left: 0; right: 0; }
.ig-sv__body[data-bg="5"] .ig-sv__text:not(.is-caption) { color: #1a1a1a; }
.ig-sv__zone { position: absolute; top: 64px; bottom: 56px; z-index: 2; background: transparent; }
.ig-sv__zone--prev { left: 0; width: 35%; }
.ig-sv__zone--next { right: 0; width: 65%; }
.ig-sv__foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 18px 16px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }
@media (max-width: 520px) { .ig-sv__stage { border-radius: 0; height: 100dvh; } }

/* ---------- Điện thoại ---------- */
@media (max-width: 820px) {
  .ig-col { padding: 10px 12px 24px; }
  .ig-col--wide { padding-top: 12px; }
  .ig-prof { gap: 18px; padding: 0 4px 18px; }
  .ig-prof__av { width: auto; }
  .ig-prof__row h2 { font-size: var(--fs-lg); }
  .ig-prof__stats { gap: 18px; }
  .ig-grid { gap: 2px; }
}

/* ---------- Thanh dưới kiểu Instagram (chế độ cổ điển) ---------- */
@media (max-width: 820px) {
  html:is([data-accent="classic"], [data-accent="tam"]) .app-rail { border-right: 0; border-top: 1px solid var(--border); }
  html:is([data-accent="classic"], [data-accent="tam"]) .app-rail__btn { color: var(--text-2); }
  html:is([data-accent="classic"], [data-accent="tam"]) .app-rail__btn.is-active { background: transparent; color: var(--text); }
  html:is([data-accent="classic"], [data-accent="tam"]) .app-rail__btn.is-active svg { stroke-width: 2.6; }
}
.ig-cp__hint { color: var(--text-3, #8a8f98); font-size: 12px; }

/* ---------- Trang cá nhân kiểu Zalo / Facebook (.pv-) ---------- */
.pv-col { max-width: 760px; padding: 0 0 56px; }
.pv { background: var(--surface); border-radius: 0 0 var(--r-xl) var(--r-xl); overflow: hidden; border: 1px solid var(--border); border-top: 0; }
.pv-cover { position: relative; width: 100%; aspect-ratio: 16 / 8; min-height: 150px; max-height: 340px; background: linear-gradient(135deg, var(--accent-2), var(--accent-strong)); overflow: hidden; }
.pv-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; -webkit-user-drag: none; }
.pv-cover::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 90px; background: linear-gradient(rgba(0,0,0,.32), transparent); pointer-events: none; }
.pv-cover__btn { position: absolute; z-index: 2; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-pill); color: #fff; background: rgba(0,0,0,.42); backdrop-filter: blur(6px); font-size: var(--fs-sm); font-weight: 600; }
.pv-cover__btn--left { right: auto; bottom: auto; left: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); width: 38px; height: 38px; padding: 0; justify-content: center; }
.pv-main { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 16px 18px; margin-top: -52px; }
.pv-bubble { max-width: 78%; margin-bottom: 8px; padding: 7px 14px; border-radius: 18px; background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); box-shadow: var(--shadow-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; }
.pv-avatar { position: relative; z-index: 1; border-radius: 50%; padding: 4px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.2); line-height: 0; }
.pv-avatar .ig-plainav, .pv-avatar .ig-ring { display: block; }
.pv-avatar__cam { position: absolute; right: 0; bottom: 4px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); border: 2px solid var(--surface); }
.pv-avatar__on { position: absolute; right: 8px; bottom: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--success); border: 3px solid var(--surface); }
.pv-name { margin: 10px 0 0; font-size: var(--fs-xl); font-weight: 700; word-break: break-word; }
.pv-sub { color: var(--text-3); margin-top: 2px; }
.pv-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; list-style: none; padding: 0; margin: 14px 0 0; }
.pv-stats li { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.pv-stats b { font-size: var(--fs-lg); }
.pv-stats span { color: var(--text-3); font-size: var(--fs-xs); }
.pv-bio { margin: 12px 0 0; max-width: 520px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; color: var(--text); }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 14px; }
.pv-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.pv-tool { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.pv-tool:hover { background: var(--hover); color: var(--text); }
.pv-tabs { display: flex; position: sticky; top: 0; z-index: 5; margin-top: 8px; background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.pv-tabs button { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 6px; height: 46px; color: var(--text-3); font-weight: 600; font-size: var(--fs-sm); border-bottom: 2px solid transparent; }
.pv-tabs button.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.pv-body { padding: 10px 0 0; display: flex; flex-direction: column; gap: 12px; }
.pv-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 14px 16px; margin: 0 12px; }
.pv-card h3 { font-size: var(--fs-md); margin: 0 0 8px; }
.pv-card__head { display: flex; justify-content: space-between; align-items: center; }
.pv-link { color: var(--accent); font-weight: 600; font-size: var(--fs-sm); }
.pv-row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; }
.pv-row + .pv-row { border-top: 1px solid var(--border); }
.pv-row__ic { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-2); }
.pv-row small { color: var(--text-3); }
.pv-row__v { word-break: break-word; }
.pv-pre { white-space: pre-wrap; }
.pv-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 12px; padding: 12px 14px; border-radius: var(--r-xl); background: var(--surface-2); color: var(--text-2); }
.pv-hint span { flex: 1; min-width: 160px; }
.pv-friends__row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.pv-friend { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; font-size: var(--fs-xs); color: var(--text-2); }
.pv-friend span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-body > .ig-grid, .pv-body > .kit-empty { margin: 0 2px; }
@media (max-width: 820px) {
  .pv-col { padding: 0 0 24px; }
  .pv { border-left: 0; border-right: 0; border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .pv-cover { aspect-ratio: 16 / 10; max-height: 300px; }
  .pv-main { margin-top: -58px; }
}

/* ---------- Video trong bài viết ---------- */
.ig-media__slide--video { display: block; background: #000; cursor: default; max-height: 78vh; }
.ig-video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.ig-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ig-cp__thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ig-cp__thumb.is-video { background: #000; }
.ig-cp__dur { position: absolute; left: 4px; bottom: 4px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .65); }
.ig-cp__hint { display: block; color: var(--text-3); font-size: var(--fs-xs, 12px); margin: -4px 0 8px; }

/* Khung đăng bài trên trang cá nhân */
.pv-compose { padding: 12px 14px; }
.pv-compose__row { display: flex; align-items: center; gap: 10px; }
.pv-compose__input { flex: 1; text-align: left; padding: 10px 16px; border-radius: var(--r-pill); background: var(--hover); color: var(--text-2); font-size: var(--fs-md); border: 1px solid var(--border); }
.pv-compose__input:hover { background: var(--surface-2, var(--hover)); }
.pv-compose__bar { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.pv-compose__q { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 6px; border-radius: var(--r-lg, 12px); font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.pv-compose__q:hover { background: var(--hover); color: var(--accent); }

.ig-compose-wrap .pv-card { margin: 0 0 12px; }

/* Dòng thời gian bài đăng trên trang cá nhân (kiểu Facebook / Zalo) */
.pv-feed { display: flex; flex-direction: column; gap: 12px; }
.pv-feed > .ig-post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); margin: 0 12px; padding: 8px 16px 12px; overflow: hidden; }
.pv-feed .ig-post__body { font-size: var(--fs-md); }
@media (max-width: 640px) { .pv-feed > .ig-post { margin: 0 8px; padding: 6px 12px 10px; } }

/* Tiến trình tải ảnh / video khi tạo bài */
.ig-cp__thumb.is-pending img, .ig-cp__thumb.is-pending video { filter: brightness(.55); }
.ig-cp__prog { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; pointer-events: none; }
.ig-cp__pct { font-size: var(--fs-xs); font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.ig-cp__spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: ig-cp-spin .8s linear infinite; }
.ig-cp__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .3); }
.ig-cp__bar i { display: block; height: 100%; width: 0; background: var(--accent, #4f8cff); transition: width .2s ease; }
.ig-cp__status { font-size: var(--fs-sm); color: var(--text-2); padding: 2px 2px 0; }
@keyframes ig-cp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ig-cp__spin { animation-duration: 2.4s; } }

/* Ảnh bài viết chia ô như Facebook / Zalo */
.ig-media--grid { display: grid; gap: 2px; background: var(--border); }
.ig-media--grid .ig-tile-img { position: relative; display: block; padding: 0; margin: 0; border: 0; background: var(--surface-3); overflow: hidden; cursor: pointer; min-width: 0; min-height: 0; }
.ig-media--grid .ig-tile-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; transition: transform .25s ease; }
.ig-media--grid .ig-tile-img:hover img { transform: scale(1.03); }
.ig-media--grid .ig-tile-img:focus-visible { outline: 2px solid var(--accent, #4f8cff); outline-offset: -2px; }
.ig-media--grid.g1 { grid-template-columns: 1fr; max-height: 78vh; }
.ig-media--grid.g2 { grid-template-columns: 1fr 1fr; aspect-ratio: 16 / 10; }
.ig-media--grid.g3 { grid-template-columns: 3fr 2fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; }
.ig-media--grid.g3 .ig-tile-img:first-child { grid-row: 1 / span 2; }
.ig-media--grid.g4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; }
.ig-tile-img__more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .52); color: #fff; font-size: clamp(24px, 6vw, 38px); font-weight: 600; letter-spacing: .5px; }

/* 5 ảnh trở lên: hai ô lớn phía trên, ba ô phía dưới (giống Facebook) */
.ig-media--grid.g5 { grid-template-columns: repeat(6, 1fr); grid-template-rows: 3fr 2fr; aspect-ratio: 6 / 5; }
.ig-media--grid.g5 .ig-tile-img { grid-column: span 2; }
.ig-media--grid.g5 .ig-tile-img:nth-child(-n + 2) { grid-column: span 3; }

/* Khám phá: khung tạo bài ở đầu trang */
.ig-explore-compose { max-width: 470px; margin: 0 auto 18px; }
.ig-cp__status.is-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--r-md, 10px); padding: 8px 10px; font-weight: 600; }

/* Hộp thoại tìm kiếm: gọn như Zalo / Facebook */
.sr .kit-modal__body { padding: 0; }
.kit-modal.sr { height: min(80%, 640px); }
.sr__wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sr__bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.sr__bar > :last-child { flex: 1; min-width: 0; }
.sr__out { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 16px; }
.sr__sec { margin-top: 8px; }
.sr__sec-h { display: flex; align-items: center; justify-content: space-between; }
.sr__sec-t { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); padding: 8px 8px 4px; }
.sr__more { color: var(--accent); font-weight: 600; font-size: var(--fs-sm); padding: 4px 8px; }
.sr__recent { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border-radius: var(--r-md); text-align: left; color: var(--text); }
.sr__recent:hover { background: var(--hover); }
.sr__recent svg { color: var(--text-2); flex: none; }
.sr__item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--r-lg, 12px); cursor: pointer; }
.sr__item:hover, .sr__item:focus-visible { background: var(--hover); outline: none; }
.sr__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sr__txt strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr__txt small { color: var(--text-2); }
.sr__txt p { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.sr__top { display: flex; align-items: baseline; gap: 2px; min-width: 0; }
.sr__thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; }
.sr__empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 12px; color: var(--text-2); text-align: center; }
@media (max-width: 560px) { .kit-modal.sr { height: 100%; max-height: none; border-radius: 0; } }

/* Phố Tám: bộ lọc nhanh */
.ig-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 0 14px; }
.ig-chip { flex: none; padding: 7px 14px; border-radius: var(--r-pill); background: var(--hover); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }
.ig-chip.is-on { background: var(--accent); color: var(--accent-text, #fff); }

.ig-top__actions { display: inline-flex; align-items: center; gap: 2px; }

/* ---------- Trang cá nhân kiểu Facebook (ghi đè) ---------- */
.pv { border: 0; border-radius: 0; overflow: visible; background: transparent; }
.pv-cover { aspect-ratio: 16 / 8; min-height: 150px; max-height: 260px; overflow: hidden; }
.pv-cover__right { position: absolute; z-index: 2; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; gap: 10px; }
.pv-cover__btn { position: static; width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
.pv-cover__btn--left { position: absolute; left: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); right: auto; bottom: auto; }
.pv-cover__btn--cam { position: absolute; right: 14px; bottom: 44px; background: rgba(255,255,255,.92); color: #111; width: 40px; height: 40px; }
.pv-main { margin-top: -28px; padding: 0 16px 14px; background: var(--surface); border-radius: 26px 26px 0 0; position: relative; z-index: 1; }
.pv-avatar-wrap { position: relative; margin-top: -78px; display: flex; flex-direction: column; align-items: center; }
.pv-bubble { position: absolute; bottom: calc(100% - 26px); max-width: 70vw; z-index: 2; }
.pv-avatar { padding: 4px; }
.pv-avatar__cam { width: 38px; height: 38px; right: 4px; bottom: 8px; }
.pv-name { font-size: 26px; margin-top: 12px; }
.pv-counts { margin-top: 4px; font-weight: 600; font-size: var(--fs-md); color: var(--text); }
.pv-sub { margin-top: 2px; }
.pv-bio { margin: 10px 0 0; max-width: 560px; }
.pv-bio.is-clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pv-bio__more { margin-top: 2px; }
.pv-actions { width: 100%; max-width: 560px; flex-wrap: nowrap; gap: 10px; margin-top: 16px; }
.pv-actions .kit-btn { flex: 1; justify-content: center; height: 44px; border-radius: 10px; font-weight: 700; }
.pv-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 14px; margin-top: 0; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.pv-tabs button { flex: none; height: 38px; padding: 0 18px; border-radius: var(--r-pill); border-bottom: 0; color: var(--text); font-weight: 600; font-size: var(--fs-md); }
.pv-tabs button.is-on { background: var(--accent-soft); color: var(--accent); border-bottom: 0; }
.pv-intro h3 { font-size: var(--fs-lg); font-weight: 800; margin: 0; }
.pv-intro__row { display: flex; align-items: center; gap: 16px; padding: 12px 4px; color: var(--text); }
.pv-intro__row svg { flex: none; color: var(--text-2); }
.pv-intro .pv-card__head { margin-bottom: 4px; }
@media (max-width: 640px) { .pv-cover { aspect-ratio: 16 / 10; min-height: 0; max-height: 30vh; } .pv-card { margin: 0 10px; } }

/* ---------- Cảm xúc bài đăng ---------- */
.ig-react { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.ig-react__e { font-size: 24px; line-height: 1; animation: ig-react-pop .35s var(--ease); }
@keyframes ig-react-pop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.ig-likes--btn { display: inline-flex; align-items: center; gap: 8px; padding: 2px 0; margin: 2px 0 4px; color: var(--text); text-align: left; }
.ig-likes--btn:hover span:last-child { text-decoration: underline; }
.ig-likes__faces { display: inline-flex; padding-left: 6px; }
.ig-likes__faces span { width: 20px; height: 20px; margin-left: -6px; display: grid; place-items: center; font-size: 12px; line-height: 1; border-radius: 50%; background: var(--surface-2); box-shadow: 0 0 0 2px var(--bg-elev); }
.ig-picker { padding: 6px 8px; gap: 2px; }
.ig-picker__btn { animation: ig-react-pop .3s var(--ease) both; }
.ig-rrow { justify-content: space-between; padding: 0; }
.ig-rrow__who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: var(--r-md); text-align: left; }
.ig-rrow__who:hover { background: var(--hover); }
.ig-rrow__rm { color: var(--text-3); font-size: var(--fs-sm); padding: 6px 8px; border-radius: var(--r-pill); }
.ig-rrow__rm:hover { background: var(--hover); color: var(--danger); }
.ig-rrow .rd__emoji { padding: 0 8px 0 4px; }

/* ---------- Bình luận và trả lời ---------- */
.ig-comments { gap: 8px; }
.ig-thread { display: flex; flex-direction: column; gap: 2px; }
.ig-comment__main { flex: 1; min-width: 0; }
.ig-cmeta { display: flex; align-items: center; gap: 14px; margin-top: 1px; font-size: var(--fs-xs); color: var(--text-3); }
.ig-creply { font-weight: 600; font-size: var(--fs-xs); color: var(--text-3); padding: 2px 0; }
.ig-creply:hover { color: var(--text); }
.ig-replytoggle { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; margin: 2px 0 0; font-size: var(--fs-sm); font-weight: 600; }
.ig-replytoggle__line { width: 24px; height: 1px; background: var(--border-strong); }
.ig-replies { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 2px 10px; padding-left: 12px; border-left: 2px solid var(--border); }
.ig-comment--reply { font-size: var(--fs-md); }
.ig-replybar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding: 4px 6px 4px 12px; border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); }
.ig-replybar[hidden] { display: none; }
.ig-replybar__x { width: 26px; height: 26px; }
@media (hover: none) { .ig-cdel { opacity: .6; } }

/* ---------- Cảm xúc bình luận ---------- */
.ig-creact { font-weight: 600; font-size: var(--fs-xs); color: var(--text-3); padding: 2px 0; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.ig-creact:hover { color: var(--text); }
.ig-creact.is-on { color: var(--accent); }
.ig-ccount { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: var(--fs-xs); color: var(--text-2); }
.ig-ccount span { font-size: 13px; line-height: 1; }
.ig-ccount span + span { margin-left: -4px; }
.ig-ccount b { font-weight: 600; margin-left: 2px; }
