/* IBIS AI — Immersive 3D Blue Pyramid Hub v6 (Responsive: phones 320px → 4K, foldables, landscape, safe-areas) */
#ibis-hub3d {
  /* Safe-area aware layout tokens (notch / Dynamic Island / home indicator / foldable hinge) */
  --hub-sa-t: env(safe-area-inset-top, 0px);
  --hub-sa-r: env(safe-area-inset-right, 0px);
  --hub-sa-b: env(safe-area-inset-bottom, 0px);
  --hub-sa-l: env(safe-area-inset-left, 0px);
  --hub-pad: 16px;
  --hub-topbar-h: 58px;
  --hub-joy: 88px;
  --hub-joy-gap: 20px;
  --hub-vh: 100vh;
  position: fixed; inset: 0; z-index: 900;
  width: 100%; height: 100vh; height: 100dvh;
  background: radial-gradient(circle at 50% 45%, #071936 0%, #020817 70%, #01040b 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  color: #f8fafc; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
@supports (height: 100dvh) { #ibis-hub3d { --hub-vh: 100dvh; } }
#ibis-hub3d.hub-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#hub3d-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#hub3d-canvas:active { cursor: grabbing; }
#ibis-hub3d :focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }

/* ── TOPBAR ─────────────────────────────────────────────────────────── */
.hub-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  padding: calc(12px + var(--hub-sa-t)) calc(var(--hub-pad) + var(--hub-sa-r)) 12px calc(var(--hub-pad) + var(--hub-sa-l));
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(2,8,23,0.88) 0%, rgba(2,8,23,0) 100%);
  pointer-events: none;
}
.hub-topbar > * { pointer-events: auto; }
/* Brand shrinks (with ellipsis) so the action buttons are NEVER pushed off-screen */
.hub-brand { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0; }
.hub-brand img { border-radius: 50%; border: 1.5px solid #38bdf8; box-shadow: 0 0 16px rgba(56,189,248,0.55); width: 32px; height: 32px; flex-shrink: 0; }
.hub-brand-txt { min-width: 0; }
.hub-brand-txt strong, .hub-brand-txt > span {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hub-brand-txt strong { font-size: 0.86rem; letter-spacing: 0.05em; color: #fff; }
.hub-brand-prefix { display: inline; }
.hub-brand-txt > span { font-size: 0.68rem; color: #38bdf8; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.hub-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hub-btn {
  border: 1px solid rgba(56,189,248,0.48); background: rgba(7,19,42,0.84);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: #e0f2fe; border-radius: 999px;
  padding: 7px 14px; font-size: 0.78rem; font-weight: 700; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
  min-height: 36px; touch-action: manipulation;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.hub-btn svg { flex-shrink: 0; }
.hub-btn:hover { transform: translateY(-1px); border-color: #7dd3fc; background: rgba(14,165,233,0.28); }
.hub-btn-logout { border-color: rgba(244,63,94,0.55); color: #fecdd3; }
.hub-btn-logout:hover { border-color: #fb7185; background: rgba(244,63,94,0.22); }
.hub-btn-cyan { border-color: transparent; background: linear-gradient(135deg, #22d3ee, #0284c7); color: #020817; font-weight: 800; }

.hub-icon-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(56,189,248,0.48); background: rgba(7,19,42,0.86);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: #e0f2fe; cursor: pointer;
  display: inline-grid; place-items: center; touch-action: manipulation;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.hub-icon-btn:hover { transform: scale(1.06); border-color: #7dd3fc; background: rgba(14,165,233,0.28); }

/* ── 3-LINE HAMBURGER DROPDOWN (scrolls on short / landscape screens) ── */
.hub-drawer {
  position: absolute; top: calc(var(--hub-topbar-h) + var(--hub-sa-t)); right: calc(var(--hub-pad) + var(--hub-sa-r)); z-index: 25;
  width: min(280px, calc(100vw - 24px - var(--hub-sa-l) - var(--hub-sa-r)));
  max-height: calc(var(--hub-vh) - var(--hub-topbar-h) - var(--hub-sa-t) - var(--hub-sa-b) - 12px);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: rgba(5,14,32,0.95); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid rgba(56,189,248,0.45); border-radius: 16px;
  padding: 8px; box-shadow: 0 22px 60px rgba(0,0,0,0.78);
  display: flex; flex-direction: column; gap: 4px;
}
.hub-drawer[hidden] { display: none; }
.hub-ditem {
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
  color: #e2e8f0; border-radius: 10px; padding: 9px 11px; min-height: 40px; flex-shrink: 0;
  font-size: 0.8rem; font-weight: 700; cursor: pointer; text-decoration: none; font-family: inherit;
  display: flex; align-items: center; gap: 8px; touch-action: manipulation;
}
.hub-ditem:hover, .hub-ditem.active { background: rgba(14,165,233,0.22); border-color: rgba(56,189,248,0.4); color: #fff; }
.hub-ditem-gold { color: #fef08a; background: rgba(250,204,21,0.12); border-color: rgba(250,204,21,0.3); }
.hub-ditem-cyan { color: #020817; background: linear-gradient(135deg, #22d3ee, #38bdf8); font-weight: 800; }
.hub-ditem-vip { color: #e9d5ff; background: rgba(168,85,247,0.16); border-color: rgba(192,132,252,0.4); }
.hub-dsep { border: 0; border-top: 1px solid rgba(56,189,248,0.2); margin: 4px 0; flex-shrink: 0; }

/* ── AVATAR CHAKRA COLOR BAR (collapsible via #hub-av-toggle / js/hub-ui.js) ── */
.hub-av-colors {
  position: absolute; right: calc(var(--hub-pad) + var(--hub-sa-r)); top: calc(var(--hub-topbar-h) + 10px + var(--hub-sa-t)); z-index: 10;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(5,15,34,0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(56,189,248,0.28); border-radius: 999px; padding: 6px;
  max-height: calc(var(--hub-vh) - var(--hub-topbar-h) - var(--hub-sa-t) - var(--hub-sa-b) - 24px);
  overflow-y: auto; scrollbar-width: none;
}
.hub-av-colors::-webkit-scrollbar { display: none; }
.hub-av-toggle {
  width: 26px; height: 26px; border-radius: 50%; padding: 0; flex-shrink: 0;
  border: 1.5px solid rgba(125,211,252,0.7); cursor: pointer; font-size: 0.8rem; line-height: 1;
  background: var(--hub-av-current, conic-gradient(#ef4444, #f97316, #facc15, #22c55e, #3b82f6, #a855f7, #ffffff, #ef4444));
  display: grid; place-items: center; touch-action: manipulation; position: relative;
  box-shadow: 0 0 10px rgba(56,189,248,0.35);
}
.hub-av-toggle::after { content: ""; position: absolute; inset: -9px; }
.hub-av-dot {
  width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.65);
  cursor: pointer; transition: transform 0.15s ease; padding: 0; flex-shrink: 0; position: relative; touch-action: manipulation;
}
.hub-av-dot::after { content: ""; position: absolute; inset: -5px; }
.hub-av-dot:hover { transform: scale(1.2); }
.hub-av-dot[aria-pressed="true"] { box-shadow: 0 0 0 2px #020817, 0 0 0 4px #7dd3fc; }
.hub-av-colors.is-collapsed { gap: 0; }
.hub-av-colors.is-collapsed .hub-av-dot { display: none; }

.hub-keys-hint {
  position: absolute; left: calc(var(--hub-pad) + var(--hub-sa-l)); bottom: calc(16px + var(--hub-sa-b)); z-index: 10;
  background: rgba(5,15,34,0.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(56,189,248,0.32); border-radius: 12px;
  padding: 9px 12px; max-width: 265px; font-size: 0.72rem; color: #cbd5e1; line-height: 1.5;
}
.hub-keys-hint strong { display: block; color: #38bdf8; margin-bottom: 3px; font-size: 0.76rem; }
.hub-kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 4px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
  color: #fff; font-weight: 800; font-size: 0.65rem; margin: 1px 1px 0 0;
}

/* ── INTERACTION PROMPT ─────────────────────────────────────────────── */
.hub-prompt {
  position: absolute; left: 50%; bottom: calc(24px + var(--hub-sa-b)); transform: translateX(-50%); z-index: 12;
  max-width: calc(100vw - 24px - var(--hub-sa-l) - var(--hub-sa-r));
  background: rgba(5,16,36,0.92); border: 1px solid #38bdf8;
  box-shadow: 0 0 22px rgba(56,189,248,0.42); border-radius: 999px;
  padding: 8px 16px; min-height: 40px; font-size: 0.82rem; font-weight: 700; color: #fff; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  touch-action: manipulation;
}
.hub-prompt[hidden] { display: none; }

/* ── INFO CARD ──────────────────────────────────────────────────────── */
.hub-card {
  position: absolute; right: calc(var(--hub-pad) + var(--hub-sa-r)); bottom: calc(16px + var(--hub-sa-b)); z-index: 14;
  width: min(390px, calc(100vw - 24px));
  max-height: calc(var(--hub-vh) - var(--hub-topbar-h) - var(--hub-sa-t) - var(--hub-sa-b) - 32px);
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(5,14,32,0.94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(56,189,248,0.48); border-radius: 16px;
  padding: 14px; box-shadow: 0 20px 50px rgba(0,0,0,0.78);
}
.hub-card[hidden] { display: none; }
.hub-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.hub-card-head h3 { font-size: 0.96rem; color: #fff; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.hub-card-close { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.08); color: #fff; cursor: pointer; font-size: 0.85rem; position: relative; }
.hub-card-close::after { content: ""; position: absolute; inset: -6px; }
.hub-card-media { width: 100%; border-radius: 10px; max-height: min(185px, 30vh); object-fit: cover; margin-bottom: 9px; border: 1px solid rgba(56,189,248,0.28); background: #020817; }
.hub-card-media[hidden] { display: none; }
.hub-card p { font-size: 0.8rem; line-height: 1.45; color: #cbd5e1; margin-bottom: 10px; }
.hub-card-cta { display: flex; gap: 7px; flex-wrap: wrap; }

/* ── VIRTUAL JOYSTICK ───────────────────────────────────────────────── */
.hub-joy {
  position: absolute; left: calc(var(--hub-pad) + var(--hub-sa-l)); bottom: calc(var(--hub-joy-gap) + var(--hub-sa-b)); z-index: 12;
  width: var(--hub-joy); height: var(--hub-joy); border-radius: 50%;
  background: rgba(14,165,233,0.14); border: 1.5px solid rgba(56,189,248,0.5);
  touch-action: none; display: none;
}
.hub-joy-knob {
  position: absolute; left: 50%; top: 50%; width: 36px; height: 36px;
  margin: -18px 0 0 -18px; border-radius: 50%;
  background: radial-gradient(circle, #7dd3fc, #0284c7);
  box-shadow: 0 0 16px rgba(56,189,248,0.75);
}

/* ── GTA 5/6 TRAILER INTRO (3D forward tilt & dissolve controlled by JS; JS keeps translate(-50%, -50%…)) ── */
.hub-gta-intro {
  position: absolute; left: 50%; top: 79%; transform: translate(-50%, -50%) perspective(620px) rotateX(0deg);
  z-index: 11; text-align: center; pointer-events: none;
  transform-origin: center bottom;
  padding: 14px 24px; border-radius: 20px; width: min(92vw, 520px);
  background: radial-gradient(ellipse at center, rgba(2,8,23,0.62) 0%, rgba(2,8,23,0) 72%);
  will-change: transform, opacity, filter;
  animation: hubIntroIn 1.1s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes hubIntroIn { from { opacity: 0; letter-spacing: 0.4em; filter: blur(8px); } to { opacity: 1; filter: blur(0); } }
.hub-gta-intro.faded { opacity: 0; }
.hub-gta-intro img {
  border-radius: 50%; border: 2px solid #38bdf8;
  box-shadow: 0 0 28px rgba(56,189,248,0.65); margin: 0 auto 6px; display: block;
  width: clamp(48px, 9vmin, 74px); height: auto; aspect-ratio: 1;
}
.hub-gta-eyebrow {
  font-size: clamp(0.6rem, 2.6vw, 0.72rem); font-weight: 800; letter-spacing: 0.2em; color: #7dd3fc;
  text-shadow: 0 0 14px rgba(56,189,248,0.8); margin-bottom: 2px; white-space: nowrap;
}
.hub-gta-intro h1 {
  margin: 0; font-size: clamp(1.8rem, 5vw, 3.4rem); font-weight: 900; letter-spacing: 0.14em; line-height: 1.1;
  color: #fff; text-shadow: 0 0 30px rgba(14,165,233,0.9), 0 4px 18px rgba(0,0,0,0.9);
}
.hub-gta-intro p {
  margin: 4px 0 0; font-size: 0.82rem; font-weight: 600; color: #e2e8f0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.95); white-space: nowrap;
}

/* ── STARGATE PORTAL WARP TRANSITION ────────────────────────────────── */
.hub-stargate-fx {
  position: absolute; inset: 0; z-index: 18; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(186,230,253,0.95) 0%, rgba(56,189,248,0.72) 28%, rgba(2,132,199,0.45) 58%, rgba(2,7,20,0.98) 100%);
  transform: scale(0.85);
  transition: opacity 0.42s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.hub-stargate-fx.active { opacity: 1; transform: scale(1.25); }

/* ── TOUCH LAYOUT: phones, small tablets AND any coarse-pointer device (incl. landscape phones > 780px wide) ── */
@media (max-width: 780px), (pointer: coarse) {
  .hub-keys-hint { display: none; }
  .hub-joy { display: block; }
  /* Intro sits low but its bottom always clears the joystick (center = 100% - 200px, box ≤ ~150px tall) */
  .hub-gta-intro { top: calc(100% - 200px - var(--hub-sa-b)); padding: 10px 14px; }
  .hub-btn { min-height: 40px; }
  .hub-icon-btn { width: 44px; height: 44px; }
  .hub-av-dot { width: 22px; height: 22px; }
  .hub-av-toggle { width: 30px; height: 30px; }
  .hub-card { right: calc(8px + var(--hub-sa-r)); left: calc(8px + var(--hub-sa-l)); width: auto; bottom: calc(var(--hub-joy) + var(--hub-joy-gap) + 12px + var(--hub-sa-b)); }
}
@media (max-width: 780px) {
  #ibis-hub3d { --hub-pad: 12px; --hub-topbar-h: 62px; }
  .hub-topbar { padding-top: calc(9px + var(--hub-sa-t)); padding-bottom: 9px; }
  .hub-brand-txt > span { display: none; }
  .hub-brand-txt strong { font-size: 0.76rem; }
  .hub-btn { padding: 6px 12px; font-size: 0.74rem; }
  .hub-av-colors { padding: 5px; gap: 7px; }
}
@media (max-width: 480px) {
  .hub-gta-intro img { width: 52px; }
  .hub-gta-eyebrow { letter-spacing: 0.12em; }
  .hub-gta-intro h1 { font-size: clamp(1.7rem, 10vw, 2.4rem); letter-spacing: 0.1em; }
  .hub-gta-intro p { font-size: 0.72rem; white-space: normal; text-wrap: balance; }
}
/* Narrow phones: action prompt docks to the RIGHT of the joystick (like a game action button) */
@media (max-width: 560px) {
  .hub-prompt {
    left: calc(var(--hub-pad) + var(--hub-sa-l) + var(--hub-joy) + 12px); right: calc(var(--hub-pad) + var(--hub-sa-r));
    bottom: calc(var(--hub-joy-gap) + var(--hub-sa-b) + var(--hub-joy) / 2); transform: translateY(50%);
    max-width: none; white-space: normal; text-align: center; line-height: 1.25; text-wrap: balance;
    border-radius: 18px; padding: 8px 12px; font-size: 0.76rem; min-height: 44px;
  }
}
@media (max-width: 440px) {
  /* Narrow phones: short brand "IBIS AI" + current room name instead of a truncated long title */
  .hub-brand-prefix { display: none; }
  .hub-brand-txt strong { font-size: 0.8rem; letter-spacing: 0.06em; }
  .hub-brand-txt > span { display: block; font-size: 0.6rem; letter-spacing: 0.04em; }
  .hub-brand { gap: 7px; }
}
@media (max-width: 359px) {
  #ibis-hub3d { --hub-pad: 10px; --hub-joy: 80px; --hub-joy-gap: 16px; }
  .hub-topbar { gap: 6px; }
  .hub-actions { gap: 6px; }
  .hub-brand img { width: 28px; height: 28px; }
  .hub-btn { padding: 6px 10px; font-size: 0.7rem; }
  .hub-gta-intro { width: calc(100vw - 16px); padding: 8px 8px; }
  .hub-gta-eyebrow { font-size: 0.56rem; letter-spacing: 0.08em; }
}
@media (max-width: 300px) {
  /* Galaxy Fold cover (280px) / tiny screens: icon-only auth button */
  #hub-btn-auth span { display: none; }
  .hub-brand-txt > span { display: none; }
}

/* ── SHORT VIEWPORTS (landscape phones, Fold landscape, split-screen) ── */
@media (max-height: 560px) {
  #ibis-hub3d { --hub-topbar-h: 52px; --hub-joy: 76px; --hub-joy-gap: 12px; }
  .hub-topbar { padding-top: calc(6px + var(--hub-sa-t)); padding-bottom: 6px; }
  .hub-brand-txt > span { display: none; }
  .hub-av-colors { top: calc(var(--hub-topbar-h) + 4px + var(--hub-sa-t)); padding: 4px; gap: 5px; }
  .hub-av-dot { width: 20px; height: 20px; }
  .hub-av-colors:not(.is-collapsed) { flex-direction: row; border-radius: 999px; max-width: calc(100vw - 2 * var(--hub-pad)); }
  .hub-gta-intro { width: min(60vw, 420px); padding: 6px 12px; top: calc(100% - 118px - var(--hub-sa-b)); }
  .hub-gta-intro img { width: 40px; margin-bottom: 2px; }
  .hub-gta-intro h1 { font-size: clamp(1.4rem, 7vh, 2.2rem); }
  .hub-gta-eyebrow { font-size: 0.58rem; }
  .hub-gta-intro p { font-size: 0.68rem; margin-top: 2px; }
  .hub-prompt { bottom: calc(14px + var(--hub-sa-b)); }
  .hub-card { bottom: calc(10px + var(--hub-sa-b)); left: auto; width: min(380px, 52vw); max-height: calc(var(--hub-vh) - var(--hub-topbar-h) - var(--hub-sa-t) - var(--hub-sa-b) - 20px); }
  .hub-card-media { max-height: 26vh; }
}
@media (max-height: 400px) {
  .hub-gta-intro img { display: none; }
  .hub-gta-intro { top: calc(100% - 90px - var(--hub-sa-b)); }
  .hub-gta-intro p { white-space: nowrap; }
}
/* Landscape phone narrower than 560px wide but short: keep the prompt centered above nothing */
@media (max-height: 560px) and (max-width: 560px) {
  .hub-prompt { bottom: calc(var(--hub-joy-gap) + var(--hub-sa-b) + var(--hub-joy) / 2); }
}

/* ── FULLSCREEN CIRCLE-TV MONITOR OVERLAY ───────────────────────────── */
.hub-tv-overlay {
  --tv-size: clamp(150px, min(76vw, 52vh), 380px);
  position: absolute; inset: 0; z-index: 30;
  padding: var(--hub-sa-t) var(--hub-sa-r) var(--hub-sa-b) var(--hub-sa-l);
  background: rgba(2,7,20,0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  animation: hubTvFadeIn 0.35s ease;
}
@supports (height: 1dvh) { .hub-tv-overlay { --tv-size: clamp(150px, min(76vw, 52dvh), 380px); } }
.hub-tv-overlay[hidden] { display: none; }
@keyframes hubTvFadeIn { from { opacity: 0; } to { opacity: 1; } }
.hub-tv-inner {
  width: min(96vw, 560px); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 46px 14px 24px; position: relative;
}
.hub-tv-close {
  position: absolute; top: 6px; right: 8px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.08);
  color: #fff; cursor: pointer; font-size: 1rem; touch-action: manipulation;
  transition: transform 0.15s ease, background 0.15s ease;
}
.hub-tv-close:hover { transform: scale(1.1); background: rgba(255,255,255,0.18); }
.hub-tv-screen {
  width: var(--tv-size); height: var(--tv-size);
  border-radius: 50%; overflow: hidden;
  border: 3px solid rgba(56,189,248,0.6);
  box-shadow: 0 0 40px rgba(56,189,248,0.35), 0 0 80px rgba(14,165,233,0.15);
  flex-shrink: 0; background: #020817;
}
.hub-tv-media { width: 100%; height: 100%; object-fit: cover; display: block; }
.hub-tv-media[hidden] { display: none; }
.hub-tv-title {
  margin: 0; font-size: clamp(1rem, 2.4vw + 0.5rem, 1.25rem); font-weight: 900; color: #fff;
  text-align: center; text-shadow: 0 0 16px rgba(56,189,248,0.7); overflow-wrap: anywhere;
}
.hub-tv-body {
  margin: 0; font-size: 0.84rem; color: #cbd5e1; text-align: center;
  line-height: 1.5; max-width: 440px;
}
.hub-tv-cta-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hub-tv-cta-row .hub-btn { min-height: 44px; padding-inline: 18px; }
.hub-tv-nav {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  border-top: 1px solid rgba(56,189,248,0.22); padding-top: 12px; margin-top: 4px; width: 100%;
}
.hub-tv-nav .hub-btn { min-height: 42px; }
.hub-tv-nav .hub-btn:disabled { opacity: 0.35; cursor: not-allowed; }
@media (max-width: 440px) {
  .hub-tv-inner { padding: 46px 10px 18px; gap: 10px; }
  .hub-tv-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .hub-tv-nav .hub-btn { width: 100%; padding-inline: 8px; }
  .hub-tv-nav #hub-tv-atrio { grid-column: 1 / -1; grid-row: 2; }
}
/* Landscape / short screens: circular screen on the left, text + buttons on the right */
@media (max-height: 560px) and (min-width: 520px) {
  .hub-tv-overlay { --tv-size: clamp(120px, min(42vw, calc(100vh - 40px)), 320px); }
  @supports (height: 1dvh) { .hub-tv-overlay { --tv-size: clamp(120px, min(42vw, calc(100dvh - 40px)), 320px); } }
  .hub-tv-inner {
    width: min(100%, 920px);
    display: grid; grid-template-columns: var(--tv-size) minmax(0, 1fr);
    column-gap: clamp(14px, 3vw, 28px); row-gap: 8px; align-content: center; align-items: center;
    padding: 14px 56px 14px 16px;
  }
  .hub-tv-screen { grid-column: 1; grid-row: 1 / span 4; align-self: center; }
  .hub-tv-title, .hub-tv-body { text-align: left; grid-column: 2; }
  .hub-tv-body { font-size: 0.8rem; max-width: none; }
  .hub-tv-cta-row, .hub-tv-nav { justify-content: flex-start; grid-column: 2; }
  .hub-tv-nav { padding-top: 8px; margin-top: 0; }
  .hub-tv-close { top: 10px; right: 10px; }
}

/* ── ACCESSIBILITY: REDUCED MOTION ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hub-gta-intro { animation: none; }
  .hub-tv-overlay { animation: none; }
  .hub-stargate-fx { transition-duration: 0.01s; }
  .hub-btn, .hub-icon-btn, .hub-av-dot, .hub-tv-close, #ibis-hub3d { transition: none; }
}

/* ── v17: animated 3D circle-TV (canvas timeline) + profile/inventory panel ── */
.hub-tv-overlay { --tv-col: #38bdf8; }
.hub-tv-kicker { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tv-col); text-shadow: 0 0 12px var(--tv-col); text-align: center; }
.hub-tv-stage { perspective: 900px; display: grid; place-items: center; touch-action: pan-y; }
.hub-tv-screen { width: var(--tv-size, min(78vw, 380px)); height: var(--tv-size, min(78vw, 380px)); border-radius: 50%; overflow: hidden; position: relative;
  border: 2px solid var(--tv-col); box-shadow: 0 0 0 6px rgba(2,7,20,0.9), 0 0 0 7px color-mix(in srgb, var(--tv-col) 55%, transparent), 0 0 46px color-mix(in srgb, var(--tv-col) 45%, transparent), inset 0 0 40px rgba(0,0,0,0.6);
  transition: transform 0.18s ease-out; transform-style: preserve-3d; will-change: transform; }
.hub-tv-screen canvas { width: 100%; height: 100%; display: block; }
.hub-tv-screen.tv-in { animation: hubTvIn 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes hubTvIn { 0% { opacity: 0; filter: blur(10px) brightness(2); clip-path: circle(4% at 50% 50%); } 60% { filter: blur(0) brightness(1.4); } 100% { opacity: 1; filter: none; clip-path: circle(75% at 50% 50%); } }
.hub-tv-progress { width: min(80vw, 380px); height: 8px; border-radius: 99px; background: rgba(255,255,255,0.1); overflow: hidden; cursor: pointer; touch-action: none; position: relative; }
.hub-tv-progress::before { content: ''; position: absolute; inset: -10px 0; }
.hub-tv-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--tv-col), #facc15); box-shadow: 0 0 12px var(--tv-col); }
.hub-tv-body { min-height: 4.4em; }
.hub-tv-dots { display: flex; gap: 8px; justify-content: center; }
.hub-tv-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--tv-col); background: transparent; cursor: pointer; padding: 0; }
.hub-tv-dot.on { background: var(--tv-col); box-shadow: 0 0 10px var(--tv-col); }
#hub-tv-next.pulse { animation: hubPulse 1.1s ease-in-out infinite; border-color: #facc15; color: #fef08a; }
@keyframes hubPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(250,204,21,0.6); } 50% { box-shadow: 0 0 0 8px rgba(250,204,21,0); } }
.hub-profile .hub-prof-inner { width: min(96vw, 560px); max-height: 92dvh; overflow-y: auto; padding: 48px 16px 20px; position: relative; display: flex; flex-direction: column; gap: 12px; }
.hub-prof-tabs { display: flex; gap: 6px; justify-content: center; }
.hub-prof-tabs button { flex: 1; min-height: 42px; border-radius: 12px; border: 1px solid rgba(192,132,252,0.45); background: rgba(10,16,36,0.85); color: #e9d5ff; font-weight: 800; cursor: pointer; }
.hub-prof-tabs button.on { background: linear-gradient(135deg, #a855f7, #6366f1); color: #fff; border-color: transparent; }
.hub-prof-body { color: #e2e8f0; font-size: 0.86rem; }
.hub-prof-body h4 { margin: 12px 0 6px; color: #c4b5fd; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }
.hub-prof-card { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: rgba(15,23,42,0.75); border: 1px solid rgba(192,132,252,0.35); }
.hub-prof-card h3 { margin: 0; font-size: 1.15rem; color: #fff; }
.hub-prof-avatar { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; font-weight: 900; color: #fff; background: radial-gradient(circle at 35% 30%, var(--av), #0b1023); box-shadow: 0 0 18px var(--av); border: 2px solid rgba(255,255,255,0.4); }
.hub-prof-tier { color: #fde68a; font-weight: 800; font-size: 0.82rem; margin: 2px 0 6px; }
.hub-prof-xp { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.1); overflow: hidden; }
.hub-prof-xp span { display: block; height: 100%; background: linear-gradient(90deg, #a855f7, #facc15); }
.hub-prof-card small { color: #94a3b8; font-size: 0.72rem; }
.hub-prof-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.hub-prof-stats div { padding: 10px; border-radius: 12px; background: rgba(15,23,42,0.7); border: 1px solid rgba(56,189,248,0.22); display: flex; flex-direction: column; gap: 2px; }
.hub-prof-stats b { color: #fff; font-size: 0.86rem; overflow-wrap: anywhere; }
.hub-prof-stats span { color: #94a3b8; font-size: 0.7rem; }
.hub-prof-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hub-prof-chips span { padding: 5px 10px; border-radius: 99px; background: rgba(250,204,21,0.14); border: 1px solid rgba(250,204,21,0.4); color: #fef08a; font-weight: 700; font-size: 0.74rem; }
.hub-inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.hub-inv-item { aspect-ratio: 1; border-radius: 14px; background: radial-gradient(circle at 50% 30%, rgba(99,102,241,0.25), rgba(15,23,42,0.85)); border: 1px solid rgba(192,132,252,0.35); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; }
.hub-inv-item .ic { font-size: 1.8rem; }
.hub-inv-item .nm { font-size: 0.68rem; color: #e2e8f0; line-height: 1.2; }
.hub-prof-empty { text-align: center; color: #94a3b8; padding: 24px 8px; }
@media (prefers-reduced-motion: reduce) { .hub-tv-screen.tv-in, #hub-tv-next.pulse { animation: none; } }
@media (max-height: 560px) and (min-width: 520px) {
  .hub-tv-stage { grid-column: 1; grid-row: 1 / span 7; align-self: center; }
  .hub-tv-kicker, .hub-tv-progress, .hub-tv-dots { grid-column: 2; justify-self: start; }
  .hub-tv-progress { width: 100%; }
}

/* ── v18: cinematic persuasive lines after the title ── */
.hub-intro-lines { position: absolute; left: 50%; top: max(17%, calc(70px + env(safe-area-inset-top))); transform: translateX(-50%); z-index: 12;
  width: min(92vw, 640px); text-align: center; pointer-events: none; }
.hub-intro-lines span { display: inline-block; font-size: clamp(1.02rem, 4.4vw, 1.6rem); font-weight: 700; line-height: 1.35; color: #e0f2fe;
  letter-spacing: 0.01em; text-shadow: 0 0 22px rgba(56,189,248,0.75), 0 2px 12px rgba(0,0,0,0.95);
  opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(8px); }
.hub-intro-lines span b { color: #fde68a; text-shadow: 0 0 18px rgba(250,204,21,0.7), 0 2px 10px rgba(0,0,0,0.9); }
.hub-intro-lines.on span { animation: hubLine 3.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes hubLine {
  0% { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(8px); letter-spacing: 0.12em; }
  18% { opacity: 1; transform: none; filter: blur(0); letter-spacing: 0.01em; }
  78% { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(-10px) perspective(500px) rotateX(35deg); filter: blur(6px); }
}
@media (prefers-reduced-motion: reduce) { .hub-intro-lines.on span { animation: none; opacity: 1; filter: none; transform: none; } }
/* intro lines placement: alternate top-left / bottom-right, final line in front of the door */
.hub-intro-lines.pos-tl { left: max(16px, env(safe-area-inset-left)); right: auto; top: max(13%, calc(64px + env(safe-area-inset-top))); transform: none; width: min(70vw, 460px); text-align: left; }
.hub-intro-lines.pos-br { left: auto; right: max(16px, env(safe-area-inset-right)); top: auto; bottom: max(22%, calc(130px + env(safe-area-inset-bottom))); transform: none; width: min(70vw, 460px); text-align: right; }
.hub-intro-lines.pos-door { left: 50%; top: 38%; transform: translateX(-50%); width: min(88vw, 560px); text-align: center; }
.hub-intro-lines.pos-door span { font-size: clamp(1.2rem, 5.2vw, 2rem); }
/* readable intro lines: glass backdrop + slower rhythm (4.6 s) */
.hub-intro-lines span { padding: 12px 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(2,8,23,0.78), rgba(4,16,40,0.62));
  -webkit-backdrop-filter: blur(8px) saturate(140%); backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(125,211,252,0.28); box-shadow: 0 10px 30px rgba(0,0,0,0.55); text-shadow: 0 2px 10px rgba(0,0,0,0.9); }
.hub-intro-lines.on span { animation: hubLine 4.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes hubLine {
  0% { opacity: 0; transform: translateY(16px) scale(0.96); filter: blur(10px); }
  14% { opacity: 1; transform: none; filter: blur(0); }
  84% { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(-10px) scale(0.98); filter: blur(6px); }
}
