/* Mobile layer (Track 1) — every rule is gated on html.is-mobile, set by
 * mobile.js from ONE matchMedia (phones: hover-less coarse pointers ≤920px
 * wide or ≤500px tall). Without the class this whole file is inert, so the
 * desktop presentation cannot drift. Overrides target style.css selectors;
 * style.css itself stays untouched (concurrent worktrees edit it).
 * Touch chrome (#mTabs #mRail #mScrub #mPeek #mBack, sheets) is injected by
 * mobile.js and styled here. */

/* ---------- 1 · kill-list: hover/keyboard chrome that has no touch use ----- */
.is-mobile .views,             /* header view nav → #mTabs bottom bar */
.is-mobile #gAutoplay,
.is-mobile #searchBtn,
.is-mobile .th__nav,           /* edge arrows → vertical swipe */
.is-mobile .th__sidetab,       /* playlist tab → rail ☰ sheet */
.is-mobile #thExit,
.is-mobile .theater__bar,      /* progress → #mScrub · seg/controls → sheets/rail */
.is-mobile .theater__foot,
.is-mobile .card__veil,        /* also dodges iOS first-tap :hover */
.is-mobile .status,            /* ⌘K / arrow-key hints — keyboard talk */
.is-mobile .brand__sb,         /* header space: UH wordmark carries the brand */
.is-mobile .brand__ch,
.is-mobile .etip { display: none !important; }

/* ---------- 2 · theater: full-bleed stage, edge to screen edge ------------ */
.is-mobile .theater { height: 100vh; height: 100dvh; }
.is-mobile body:has(#viewTheater:not([hidden])) .bar--top { display: none; }
.is-mobile .theater__stage { min-height: 0; }

/* ---------- 3 · scroll discipline ----------------------------------------- */
/* no pull-to-refresh / overscroll glow anywhere; the stage owns its gestures */
.is-mobile { overscroll-behavior: none; }
.is-mobile body { overscroll-behavior: none; }
.is-mobile #thStage { touch-action: none; -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none; }

/* ---------- 4 · injected chrome: inert unless mobile ----------------------- */
#mTabs, #mRail, #mScrub, #mBack, #mPeek, .mflash { display: none; }

/* ---------- 5 · bottom tab bar --------------------------------------------- */
.is-mobile #mTabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  display: flex; background: var(--scrim); backdrop-filter: blur(14px);
  border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
.is-mobile body:has(#viewTheater:not([hidden])) #mTabs { display: none; }
.mtabs__btn { flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: .15rem; padding: .45rem 0 .4rem; font: 600 .6rem var(--display);
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  touch-action: manipulation; }
.mtabs__btn.is-active { color: var(--accent); }
.mtabs__glyph { font-size: 1.05rem; line-height: 1; }
/* room for the tab bar under every scrolling view */
.is-mobile #feedwrap, .is-mobile .board, .is-mobile .create, .is-mobile .wiki,
.is-mobile .foot { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

/* ---------- 6 · right action rail (theater) -------------------------------- */
.is-mobile #mRail { display: flex; flex-direction: column; gap: .55rem;
  position: absolute; right: calc(.6rem + env(safe-area-inset-right));
  bottom: calc(4.4rem + env(safe-area-inset-bottom)); z-index: 8; }
/* TikTok-style: icon circle + tiny caption, both inside the hit area */
.mrail__btn { display: flex; flex-direction: column; align-items: center;
  gap: .18rem; width: 52px; padding: 0; background: none; border: 0;
  touch-action: manipulation; color: var(--ink); }
.mrail__btn b { width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font: 600 1.05rem var(--display);
  background: rgb(0 0 0 / .55); border: 1px solid rgb(255 255 255 / .18); }
.mrail__btn i { font: 500 .55rem var(--mono); font-style: normal;
  color: var(--ink); text-shadow: 0 1px 3px rgb(0 0 0 / .8);
  letter-spacing: .03em; }
.mrail__btn.is-on b { color: var(--accent); border-color: var(--accent); }
.mrail__btn[disabled] { opacity: .4; }
.mrail__btn--cc b { font-size: .62rem; letter-spacing: .02em; }

/* ---------- 7 · thin scrub bar over the stage bottom ----------------------- */
.is-mobile #mScrub { display: block; position: absolute; left: 0; right: 0;
  bottom: env(safe-area-inset-bottom); height: 28px; z-index: 8; }
.mscrub__track, .mscrub__line { position: absolute; left: 0; bottom: 6px;
  height: 3px; pointer-events: none; transition: height .15s; }
.mscrub__track { right: 0; background: rgb(255 255 255 / .22); }
.mscrub__line { width: 0%; background: var(--accent); }
.is-mobile #mScrub.is-scrubbing .mscrub__track,
.is-mobile #mScrub.is-scrubbing .mscrub__line { height: 6px; }
.mscrub__bubble { position: absolute; bottom: 24px; translate: -50% 0;
  padding: .2rem .55rem; border-radius: 999px; background: rgb(0 0 0 / .78);
  border: 1px solid rgb(255 255 255 / .18); font: 500 .72rem var(--mono);
  color: var(--ink); pointer-events: none; white-space: nowrap; }

/* tap feedback: center ▶/⏸ pop */
.is-mobile .mflash { display: grid; place-items: center; position: absolute;
  left: 50%; top: 50%; translate: -50% -50%; width: 74px; height: 74px;
  border-radius: 50%; background: rgb(0 0 0 / .5); font-size: 1.9rem;
  opacity: 0; pointer-events: none; z-index: 7; }
.is-mobile .mflash.is-live { animation: mflash .55s ease-out; }
@keyframes mflash { 0% { opacity: 0; scale: .7; } 25% { opacity: 1; scale: 1.05; }
  70% { opacity: 1; } 100% { opacity: 0; scale: 1; } }

/* pause X-ray → slim strip above the scrub bar (not the 46% side panel):
 * pills + compact fighter cards in horizontally scrolling rows */
.is-mobile .th__xray { top: auto; left: 0; right: 0; width: auto;
  bottom: calc(28px + env(safe-area-inset-bottom));
  max-height: 40dvh; z-index: 6;
  padding: .8rem calc(56px + env(safe-area-inset-right)) .4rem .75rem;
  background: linear-gradient(180deg, transparent, rgb(0 0 0 / .88) 40%);
  gap: .4rem; animation: mxrayIn .25s ease-out; }
@keyframes mxrayIn { from { opacity: 0; translate: 0 10px; } }
.is-mobile .thx__name { display: none; }   /* the lower-third already said it */
.is-mobile .thx__cards { flex-direction: row; overflow-x: auto; margin: 0;
  scrollbar-width: none; touch-action: pan-x; }
.is-mobile .thx__cards::-webkit-scrollbar { display: none; }
.is-mobile .thx__meta, .is-mobile .thx__tags { flex-wrap: nowrap;
  overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.is-mobile .thx__meta::-webkit-scrollbar,
.is-mobile .thx__tags::-webkit-scrollbar { display: none; }
.is-mobile .thx__cards .xcard { flex: 0 0 auto; }
.is-mobile .thx__meta > *, .is-mobile .thx__tags > * { flex: 0 0 auto; }

/* ---------- 7b · swipe peek + drag state ------------------------------------ */
/* the neighbouring video during a drag: poster + meta on black, one layer
 * above the player, below all touch chrome */
.is-mobile #mPeek { display: block; position: absolute; inset: 0; z-index: 3;
  background: #000; will-change: transform; }
.is-mobile #mPeek[hidden] { display: none; }
.mpeek__img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; }
.mpeek__meta { position: absolute; left: .9rem; right: 4.2rem;
  bottom: calc(3.2rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: .2rem; }
.mpeek__meta b { font: 600 1.05rem/1.25 var(--display); }
.mpeek__meta span { font: 400 .8rem var(--mono); color: var(--muted); }
.is-mobile #thPlayer { will-change: transform; }
/* frozen last frame of the outgoing video during a commit — must cover the
 * stage exactly like the player did (unstyled it rendered as an inline
 * canvas: the "weird remaining of the old frame" artifact) */
.is-mobile .mghost { position: absolute; inset: 0; z-index: 3; background: #000;
  will-change: transform; overflow: hidden; }
.is-mobile .mghost canvas, .is-mobile .mghost img { width: 100%; height: 100%;
  object-fit: contain; display: block; }
.mghost { display: none; }
.is-mobile .mghost { display: block; }
.mpeek__exit { color: var(--accent); }
/* transient overlays get out of the way while a finger is on the stage */
.is-mobile .theater__stage.is-dragging .th__lower,
.is-mobile .theater__stage.is-dragging .th__unmute,
.is-mobile .theater__stage.is-dragging .th__xray,
.is-mobile .theater__stage.is-dragging .th__break { opacity: 0; transition: opacity .15s; }
/* …and the lower-third yields to the pause X-ray strip (same screen zone) */
.is-mobile .theater__stage.is-paused .th__lower { opacity: 0; transition: opacity .15s; }

/* ---------- 7c · bottom sheets: ⓘ details + ☰ playlist --------------------- */
#mListSheet, .msheet-scrim { display: none; }
.is-mobile .msheet-scrim { display: block; position: fixed; inset: 0; z-index: 44;
  background: rgb(0 0 0 / .45); opacity: 0; pointer-events: none;
  transition: opacity .25s; }
.is-mobile .msheet-scrim.is-live { opacity: 1; pointer-events: auto; }
.is-mobile #thDetail, .is-mobile #mListSheet:not([hidden]) { display: block;
  position: fixed; inset: auto 0 0 0; z-index: 45; max-height: 72dvh;
  overflow: hidden; background: var(--paper-2); border-top: 1px solid var(--rule);
  border-radius: 16px 16px 0 0;
  padding: 1.9rem .9rem calc(.6rem + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.7,.3,1); }
.is-mobile #thDetail.is-sheet-open, .is-mobile #mListSheet.is-sheet-open {
  transform: translateY(0); }
.is-mobile #thDetail.is-sheet-dragging, .is-mobile #mListSheet.is-sheet-dragging {
  transition: none; }
.is-mobile #thDetail::before, .is-mobile #mListSheet::before { content: "";
  position: absolute; top: .55rem; left: 50%; translate: -50% 0; width: 44px;
  height: 4px; border-radius: 999px; background: var(--rule); }
/* sheet innards: native scroll below the grip zone */
.is-mobile #thDetail .theater__info { max-height: calc(72dvh - 3.5rem);
  overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; }
.is-mobile #mListSheet .theater__side { display: block; width: auto; border: 0;
  max-height: calc(72dvh - 6.5rem); overflow-y: auto; touch-action: pan-y;
  overscroll-behavior: contain; }
.is-mobile #mListSheet #thPlaylistSeg { display: flex; margin: 0 0 .6rem;
  width: max-content; }
.msheet__title { display: none; }
.is-mobile #mListSheet .msheet__title { display: block;
  font: 600 .8rem var(--display); text-transform: uppercase;
  letter-spacing: .08em; margin: 0 0 .55rem; }
.is-mobile #mListSheet .msheet__title span { font: 400 .68rem var(--mono);
  color: var(--muted); text-transform: none; letter-spacing: 0; }
/* pills must never letter-break out of their rounded borders */
.is-mobile #thDetail .theater__info .epill,
.is-mobile #thDetail .theater__info .mi__award {
  overflow-wrap: normal; white-space: nowrap; flex: 0 0 auto; }
.is-mobile #thDetail .mi__season { display: flex; flex-wrap: wrap;
  gap: .35rem; align-items: center; }

/* ---------- 7d · intermission restacked for portrait ----------------------- */
/* watched · spinner+skip · up-next go vertical; star targets grow */
.is-mobile .th__break { grid-template-columns: 1fr; grid-auto-rows: auto;
  align-content: center; justify-items: center; gap: 1.1rem;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem
           calc(3rem + env(safe-area-inset-bottom)); }
.is-mobile .thb__thumb img { height: 16vh; max-height: 150px; }
.is-mobile .thb__star { font-size: 1.7rem; padding: .15rem .3rem; }
.is-mobile .thb__skip { padding: .55rem 1.2rem; }

/* info card: never bleed past the sheet edge */
.is-mobile #thDetail .theater__info { overflow-x: hidden; }
.is-mobile #thDetail .theater__info * { min-width: 0; overflow-wrap: anywhere; }

/* ---------- 7e · calm (immersive) mode -------------------------------------- */
/* chrome fades after 4s of playback or a horizontal "swipe out"; the ⤢
 * corner arrow (or pausing, or a new video) brings it back */
#mWake { display: none; }
.is-mobile #mRail, .is-mobile #mBack, .is-mobile .th__back,
.is-mobile #mScrub { transition: opacity .4s; }
.is-mobile .theater__stage.is-calm #mRail,
.is-mobile .theater__stage.is-calm #mBack,
.is-mobile .theater__stage.is-calm .th__back { opacity: 0; pointer-events: none; }
.is-mobile .theater__stage.is-calm #mScrub { opacity: .45; }
.is-mobile .theater__stage.is-calm #mWake { display: grid; place-items: center;
  position: absolute; left: calc(.6rem + env(safe-area-inset-left));
  bottom: calc(38px + env(safe-area-inset-bottom)); width: 38px; height: 38px;
  border-radius: 50%; z-index: 8; background: rgb(0 0 0 / .35);
  border: 1px solid rgb(255 255 255 / .14); color: var(--muted);
  font-size: 1.05rem; opacity: 0; animation: mwakein .5s .3s forwards; }
@keyframes mwakein { to { opacity: .75; } }

/* ---------- 8 · back pills ------------------------------------------------- */
.is-mobile #mBack:not([hidden]) { display: inline-block; }
/* no hover to wake the pill — always visible, clear of the notch */
.is-mobile .th__back { opacity: 1; pointer-events: auto; animation: none;
  top: calc(.6rem + env(safe-area-inset-top));
  left: calc(.6rem + env(safe-area-inset-left)); }

/* ---------- 8b · leaderboard: fit a phone ----------------------------------- */
/* keep rank · creator · medals · wins · entries · prize; drop follower/view
 * counts and the seasons column (they live on the creator pages) */
.is-mobile .board { padding: 1.2rem .5rem 6rem; overflow-x: hidden; }
.is-mobile .board table { font-size: .78rem; }
.is-mobile .board th, .is-mobile .board td { padding: .45rem .3rem; }
.is-mobile .board th:nth-child(6), .is-mobile .board td:nth-child(6),
.is-mobile .board th:nth-child(7), .is-mobile .board td:nth-child(7),
.is-mobile .board th:nth-child(8), .is-mobile .board td:nth-child(8),
.is-mobile .board th:nth-child(10), .is-mobile .board td:nth-child(10) {
  display: none; }
.is-mobile .board .who .nm, .is-mobile .board .who .ext { display: none; }
.is-mobile .board .who a { overflow-wrap: anywhere; }
.is-mobile .board .rank { width: 1.6rem; }
.is-mobile .board .medals { letter-spacing: -.08em; }

/* ---------- 9 · compact header + horizontally scrolling filter bar --------- */
.is-mobile .bar--top { gap: .5rem; padding-inline: .75rem; }
.is-mobile .brand { gap: .4rem; }
.is-mobile .brand__x { display: none; }
.is-mobile .premiere-btn { font-size: .7rem; padding: .32rem .7rem; }
.is-mobile .bar--filters { flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none; touch-action: pan-x; }
.is-mobile .bar--filters::-webkit-scrollbar { display: none; }
.is-mobile .bar--filters .chips { flex-wrap: nowrap; }
