/* X (mobile app) */
.phone[data-platform='x'] {
  --bg: #ffffff; --fg: #0f1419; --fg2: #536471; --sep: #eff3f4; --elev: #f7f9f9; --accent: #1d9bf0; --link: #1d9bf0;
  --like: #f91880; --rt: #00ba7c;
  --font: 'Chirp', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.phone[data-platform='x'][data-theme='dark'] {
  --bg: #000000; --fg: #e7e9ea; --fg2: #71767b; --sep: #2f3336; --elev: #16181c;
}
.phone[data-platform='x'][data-device='android'] { --font: Roboto, 'Segoe UI', Arial, sans-serif; }
.phone[data-platform='x'] .phone-screen { font-size: 15.5px; }

/* Header */
.x-topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--sep); }
.x-status-cover { background: var(--bg); }
.x-bar { position: relative; height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.x-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.x-logo .ico { width: 26px !important; height: 26px !important; }
.x-upgrade { border: 1px solid var(--sep) !important; border-radius: 16px; padding: 3px 12px !important; font-size: 14px; font-weight: 700; }
.x-tabs { position: relative; display: flex; height: 50px; }
.x-tabs button { flex: 1; font-size: 15px; font-weight: 500; color: var(--fg2); }
.x-tabs button.on { color: var(--fg); font-weight: 700; }
.x-tabs .line { position: absolute; left: 0; bottom: 0; width: 50%; height: 4px; display: flex; justify-content: center; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.x-tabs .line::before { content: ''; width: 56px; height: 4px; border-radius: 2px; background: var(--accent); }
.x-top-space { height: calc(var(--st) + 101px); }

/* Post */
.x-post { border-bottom: 1px solid var(--sep); padding: 12px 16px 4px; }
.x-pinned { display: flex; align-items: center; gap: 8px; color: var(--fg2); font-size: 13px; font-weight: 700; margin: -2px 0 4px 20px; }
.x-pinned .ico { width: 16px !important; height: 16px !important; }
.x-row { display: flex; gap: 10px; }
.x-av { flex: none; }
.x-body { flex: 1; min-width: 0; }
.x-head { display: flex; align-items: center; gap: 4px; white-space: nowrap; line-height: 20px; }
.x-head b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.x-head .badge { width: 17px !important; height: 17px !important; }
.x-head span { color: var(--fg2); overflow: hidden; text-overflow: ellipsis; flex: 1; }
.x-head button { color: var(--fg2); flex: none; margin-left: 8px; }
.x-head button .ico { width: 18px; height: 18px; }
.x-head .x-grok { margin-left: 4px; }
.x-text { margin-top: 2px; line-height: 20px; word-wrap: break-word; }
.x-media { margin-top: 12px; border-radius: 16px; overflow: hidden; border: 1px solid var(--sep); display: grid; gap: 2px; max-height: 520px; background: var(--sep); }
.x-media.n2 { grid-template-columns: 1fr 1fr; }
.x-media.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.x-media.n3 .x-mi:first-child { grid-row: span 2; }
.x-media.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.x-mi { position: relative; overflow: hidden; min-height: 0; display: block; }
.x-mi > .m { position: absolute; inset: 0; }
.x-vid-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.77); color: #fff; font-size: 13px; padding: 0 5px; border-radius: 4px; font-weight: 500; }
.x-vid-mute { position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.77); color: #fff; display: grid; place-items: center; }
.x-vid-mute .ico { width: 15px !important; height: 15px !important; }
.x-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; color: var(--fg2); height: 38px; }
.x-actions button { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; min-width: 50px; position: relative; }
.x-actions .ico { width: 18.5px; height: 18.5px; }
.x-act-end { display: flex; gap: 14px; }
.x-act-end button { min-width: 0; }
.x-like.on { color: var(--like); }
.x-rt.on { color: var(--rt); }
.x-bm.on { color: var(--accent); }
.x-like.burst::after {
  content: ''; position: absolute; left: 9px; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  border: 2px solid var(--like); animation: xBurst .5s ease-out forwards; pointer-events: none;
}
@keyframes xBurst { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.2); opacity: 0; border-width: 0; } }
.x-fab {
  position: absolute; right: 16px; bottom: calc(var(--tabbar) + 16px); width: 56px; height: 56px; border-radius: 50% !important;
  background: var(--accent) !important; color: #fff !important; display: grid; place-items: center; z-index: 25;
  box-shadow: 0 3px 12px rgba(0,0,0,.25); transition: opacity .3s;
}
.x-fab .ico { width: 26px; height: 26px; stroke-width: 2.4; }
.x-fab.dim { opacity: .45; }
.phone[data-platform='x'] .tabbar { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--sep); }

/* Lightbox */
.x-lightbox { --dim: 1; background: rgba(0,0,0,var(--dim)); color: #fff; animation: layerFade .2s ease-out; transition: opacity .2s; }
.x-lightbox.closing { opacity: 0; }
.x-lb-media { position: absolute; inset: 0; }
.x-lb-media .car, .x-lb-media .m { background: transparent; }
.x-lb-media .m-filler.contain { inset: 25% 0; height: 50%; position: absolute; }
.x-lb-top { position: absolute; top: var(--st); left: 0; right: 0; height: 48px; display: flex; align-items: center; padding: 0 12px; z-index: 3; transition: opacity .2s; }
.x-lb-top button { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.5) !important; display: grid; place-items: center; }
.x-lb-top .ico { width: 20px; height: 20px; }
.x-lb-actions { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 20px calc(var(--sb) + 8px); display: flex; justify-content: space-between; z-index: 3; font-size: 13px; transition: opacity .2s; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.x-lb-actions span { display: inline-flex; align-items: center; gap: 5px; }
.x-lb-actions .ico { width: 20px; height: 20px; }
.x-lightbox.bare .x-lb-top, .x-lightbox.bare .x-lb-actions { opacity: 0; }

/* Profile */
.x-profile .scroller { padding-bottom: var(--tabbar); }
.x-banner { height: calc(var(--st) + 96px); overflow: hidden; transform-origin: 50% 100%; background: var(--elev); }
.x-banner .m { width: 100%; height: 100%; }
.x-prof-head { position: relative; padding: 10px 16px 0; }
.x-prof-av { position: absolute; top: -40px; left: 14px; border-radius: 50%; box-shadow: 0 0 0 4px var(--bg); }
.x-edit { float: right; border: 1px solid color-mix(in srgb, var(--fg2) 50%, transparent) !important; border-radius: 18px; padding: 6px 16px !important; font-weight: 700; font-size: 14px; }
.x-prof-head h1 { clear: both; margin: 0; padding-top: 14px; font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.x-prof-head h1 .badge { width: 20px; height: 20px; }
.x-handle { margin: 0; color: var(--fg2); }
.x-bio { margin: 12px 0 0; line-height: 20px; }
.x-meta { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--fg2); font-size: 14.5px; }
.x-meta span { display: inline-flex; align-items: center; gap: 4px; }
.x-meta .lnk { color: var(--link); }
.x-meta .ico { width: 17px; height: 17px; }
.x-follow { margin: 12px 0 0; color: var(--fg2); font-size: 14.5px; }
.x-follow b { color: var(--fg); font-weight: 700; }
.x-follow b + b, .x-follow b:last-of-type { margin-left: 16px; }
.x-follow b:first-child { margin-left: 0; }
.x-ptabs { position: sticky; top: calc(var(--st) + 50px); z-index: 10; background: var(--bg); display: flex; height: 50px; border-bottom: 1px solid var(--sep); margin-top: 12px; }
.x-ptabs button { flex: none; padding: 0 16px !important; font-size: 15px; font-weight: 500; color: var(--fg2); }
.x-ptabs button.on { color: var(--fg); font-weight: 700; }
.x-ptabs .line { position: absolute; left: 0; bottom: 0; height: 4px; border-radius: 2px; background: var(--accent); width: 50px; transition: transform .3s cubic-bezier(.2,.8,.2,1), width .3s; }
.x-panes { height: auto; transition: height .25s; }
.x-panes .car-track { align-items: flex-start; height: auto; }
.x-panes .car-slide { height: auto; }
.x-mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px 0; }
.x-mtile { aspect-ratio: 1; overflow: hidden; }
.x-none { padding: 40px 20px; text-align: center; color: var(--fg2); margin: 0; font-size: 15px; }
.x-prof-bar { position: absolute; inset: 0 0 auto 0; z-index: 20; padding: var(--st) 12px 0; height: calc(var(--st) + 50px); display: flex; align-items: center; gap: 10px; transition: background .25s; }
.x-prof-bar.solid { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); }
.x-circ { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.55) !important; color: #fff !important; display: grid; place-items: center; transition: background .25s, color .25s; }
.x-circ .ico { width: 20px; height: 20px; }
.x-prof-bar.solid .x-circ { background: transparent !important; color: var(--fg) !important; }
.x-pbar-title { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; line-height: 1.2; }
.x-pbar-title b { display: block; font-size: 17px; font-weight: 800; }
.x-pbar-title small { color: var(--fg2); font-size: 13px; }
.x-prof-bar.solid .x-pbar-title { opacity: 1; transform: none; }
