/* Mobile layout and touch usability improvements */
@media (max-width:700px) {
  html, body { width:100%; overflow-x:hidden; }
  #app { min-height:100dvh; }
  .vs-view { width:100%; min-height:100dvh; padding:68px 12px calc(24px + env(safe-area-inset-bottom)); }
  .vs-screen { min-width:0; }
  .vs-page-title { margin-bottom:16px; }
  .vs-page-title h1 { font-size:clamp(1.45rem,6vw,1.9rem); line-height:1.15; }
  .vs-page-title p { font-size:.92rem; line-height:1.45; }
  .vs-screen .btn, .modal .btn, .offcanvas .btn { min-height:42px; }
  .vs-screen input, .vs-screen select, .vs-screen textarea, .modal input, .modal select, .modal textarea { min-height:44px; font-size:16px; }
  .vs-menu-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
  .vs-tile { min-width:0; min-height:92px; padding:12px 5px; gap:8px; overflow-wrap:anywhere; }
  .vs-hud { padding-left:max(10px,env(safe-area-inset-left)); padding-right:max(10px,env(safe-area-inset-right)); }
  .modal-dialog { margin:8px; }
  .modal-content { max-height:calc(100dvh - 16px); overflow:hidden; }
  .modal-body { overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .dropdown-menu { max-width:calc(100vw - 24px); }
  .vs-list > *, .list-group-item { overflow-wrap:anywhere; }
}
@media (max-width:380px) {
  .vs-view { padding-left:9px; padding-right:9px; }
  .vs-menu-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* Phone shell and messaging layout refinements */
.vs-phone-modal { width:100%; }
.vs-phone-shell { width:100%; }
.vs-phone-panel { overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.vs-phone-app { cursor:pointer; }
.vs-chat-inbox-list, .vs-chat-messages { overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.vs-chat-message { overflow-wrap:anywhere; }
@media (max-width:700px) {
  .vs-phone-modal { max-width:none; width:100%; margin:0; }
  .vs-phone-shell { min-height:0; padding:8px; border-radius:14px; }
  .vs-phone-screen { height:min(74dvh,720px); min-height:440px; }
  .vs-phone-panel { padding:10px; }
  .vs-phone-apps { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .vs-phone-app { min-height:82px; padding:8px 4px; }
  .vs-phone-app b { font-size:22px; }
  .vs-phone-app span { font-size:11px; text-align:center; overflow-wrap:anywhere; }
  .vs-phone-tabs { scrollbar-width:thin; }
  .vs-phone-tabs button { min-height:40px; white-space:nowrap; flex:0 0 auto; }
  .vs-chat-layout { grid-template-columns:minmax(0,1fr); min-height:0; }
  .vs-chat-inbox-list { max-height:180px; }
  .vs-chat-messages { max-height:none; flex:1 1 auto; min-height:180px; }
  .vs-chat-conversation { min-height:0; }
  .vs-chat-header { gap:8px; flex-wrap:wrap; }
  .vs-chat-conversation > .input-group { gap:6px; }
  .vs-chat-conversation > .input-group .form-control { min-width:0; }
}
@media (max-width:380px) {
  .vs-phone-apps { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .vs-phone-screen { min-height:400px; }
}

/* Phone UX refresh v2: stronger hierarchy, comfortable targets, and clear news types */
.vs-phone-shell {
  background: linear-gradient(155deg,#171b1d 0%,#101314 100%);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 24px 70px rgba(0,0,0,.38);
}
.vs-phone-status { min-height:34px; padding:5px 11px; color:#e7e9e8; }
.vs-phone-status > strong { letter-spacing:.13em; font-size:10px; }
.vs-phone-power { min-width:34px; min-height:30px; border-radius:10px; }
.vs-phone-screen { background:#111516; border:1px solid rgba(255,255,255,.08); border-radius:17px; overflow:hidden; }
.vs-phone-toolbar {
  min-height:52px; padding:8px 11px; gap:9px;
  background:rgba(24,29,30,.98); border-bottom:1px solid rgba(255,255,255,.09);
}
.vs-phone-toolbar > button { min-width:38px; min-height:36px; font-size:20px; border-radius:11px; }
.vs-phone-toolbar #phoneTitle { flex:1; font-size:13px; font-weight:750; letter-spacing:.015em; }
.vs-phone-panel { padding:14px; background:#111516; }
.vs-phone-home { display:flex; flex-direction:column; gap:0; }
.vs-phone-welcome {
  padding:16px; margin-bottom:17px; border:1px solid rgba(255,255,255,.09); border-radius:18px;
  background:linear-gradient(135deg,rgba(248,148,6,.15),rgba(255,255,255,.025) 68%);
}
.vs-phone-kicker,.vs-news-eyebrow { display:block; color:#f6b34b; font-size:10px; font-weight:800; letter-spacing:.14em; }
.vs-phone-welcome h2 { font-size:22px; line-height:1.2; margin:8px 0 4px; font-weight:800; }
.vs-phone-welcome p { color:#b9c0c0; font-size:12px; margin:0 0 15px; }
.vs-phone-clock { display:grid; gap:3px; padding:12px 13px; border-radius:12px; background:rgba(0,0,0,.23); border:1px solid rgba(255,255,255,.07); }
.vs-phone-clock > span { font-size:9px; letter-spacing:.11em; font-weight:800; color:#aeb7b7; }
.vs-phone-clock strong { font-size:25px; line-height:1.15; color:#fff; }
.vs-phone-clock small { color:#c4cbca; font-size:11px; }
.vs-phone-home-section { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin:2px 1px 9px; }
.vs-phone-home-section strong { font-size:13px; font-weight:800; color:#f1f3f2; }
.vs-phone-home-section > span { font-size:10px; color:#9da6a5; text-align:right; }
.vs-phone-apps { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-bottom:18px; }
.vs-phone-app {
  position:relative; display:flex; align-items:center; gap:11px; text-align:left;
  min-width:0; min-height:69px; padding:11px; border-radius:14px;
  border:1px solid rgba(255,255,255,.09); background:#1b2021; color:#f3f5f4;
  transition:background .16s ease,border-color .16s ease,transform .16s ease;
}
.vs-phone-app:active { transform:scale(.98); }
.vs-phone-app:hover,.vs-phone-app:focus-visible { background:#252c2d; border-color:rgba(248,148,6,.55); outline:none; }
.vs-phone-app b { display:grid; place-items:center; flex:0 0 38px; width:38px; height:38px; border-radius:12px; color:#ffc66d; background:rgba(248,148,6,.12); font-size:22px; font-weight:700; }
.vs-phone-app span { font-size:12px; line-height:1.25; font-weight:700; overflow-wrap:anywhere; }
.vs-phone-app .vs-phone-dot { position:absolute; top:7px; right:8px; }
.vs-phone-panel .vs-list-row { padding:13px 12px; border-radius:12px; margin-bottom:7px; border:1px solid rgba(255,255,255,.075); background:#1b2021; }
.vs-phone-panel .btn { min-height:40px; }
.vs-phone-tabs { display:flex; gap:7px; padding:5px 0 10px; overflow-x:auto; }
.vs-phone-tabs button { border-radius:11px; }
.vs-phone-panel input,.vs-phone-panel select,.vs-phone-panel textarea { font-size:16px; min-height:44px; }

/* World news: category labels distinguish forecasts from reports and incidents. */
.vs-news { min-width:0; }
.vs-news-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:3px 1px 14px; }
.vs-news-heading h2 { margin:5px 0 3px; font-size:23px; font-weight:850; letter-spacing:-.035em; }
.vs-news-heading p { margin:0; color:#aeb8b7; font-size:12px; }
.vs-news-refresh { flex:0 0 42px; width:42px; height:42px; border-radius:13px; border:1px solid rgba(255,255,255,.12); background:#222829; color:#ffc66d; font-size:24px; }
.vs-news-categories { display:flex; gap:7px; margin:0 -2px 15px; padding:0 2px 5px; overflow-x:auto; scrollbar-width:thin; }
.vs-news-category { flex:0 0 auto; display:flex; align-items:center; gap:7px; min-height:43px; padding:8px 12px; border:1px solid rgba(255,255,255,.1); border-radius:12px; background:#1b2021; color:#d8dddc; }
.vs-news-category span { font-size:16px; color:#f6b34b; }
.vs-news-category b { font-size:11px; font-weight:750; }
.vs-news-category.active { border-color:#f89406; background:rgba(248,148,6,.14); color:#fff; box-shadow:inset 0 0 0 1px rgba(248,148,6,.12); }
.vs-news-section-intro { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:12px 2px 10px; border-top:1px solid rgba(255,255,255,.08); }
.vs-news-section-intro > div { display:grid; gap:3px; }
.vs-news-section-intro strong { font-size:14px; }
.vs-news-section-intro span,.vs-news-section-intro small { color:#aab3b2; font-size:10px; line-height:1.4; }
.vs-news-section-intro small { white-space:nowrap; }
.vs-news-list { display:grid; gap:10px; }
.vs-news-card { min-width:0; padding:14px; border:1px solid rgba(255,255,255,.09); border-radius:15px; background:linear-gradient(150deg,#1d2324,#181d1e); }
.vs-news-card-top { display:flex; align-items:center; justify-content:space-between; gap:7px; margin-bottom:9px; }
.vs-news-type,.vs-news-severity { display:inline-flex; align-items:center; min-height:24px; padding:4px 8px; border-radius:7px; font-size:9px; font-weight:850; letter-spacing:.035em; }
.vs-news-type.report { color:#ffd28a; background:rgba(248,148,6,.13); }
.vs-news-type.forecast { color:#b7d9ff; background:rgba(83,151,238,.15); }
.vs-news-type.incident { color:#ffb1a8; background:rgba(219,75,60,.15); }
.vs-news-type.response { color:#b7e5c4; background:rgba(61,164,100,.15); }
.vs-news-type.event { color:#bde8c9; background:rgba(61,164,100,.14); }
.vs-news-severity { color:#f1c1bb; background:rgba(219,75,60,.12); }
.vs-news-severity.critical,.vs-news-severity.high { color:#fff; background:#a9362d; }
.vs-news-severity.moderate { color:#ffe0a6; background:rgba(203,133,32,.19); }
.vs-news-card h3 { margin:0 0 8px; font-size:15px; line-height:1.38; font-weight:800; color:#f7f8f7; overflow-wrap:anywhere; }
.vs-news-card p { margin:0; color:#c1c9c8; font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.vs-news-card footer { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:13px; padding-top:10px; border-top:1px solid rgba(255,255,255,.07); }
.vs-news-date,.vs-news-no-calendar { color:#98a3a2; font-size:10px; }
.vs-news-calendar-link { border:0; background:transparent; color:#ffc66d; font-size:11px; font-weight:800; padding:5px 0 5px 8px; }
.vs-news-calendar-link span { margin-left:4px; font-size:16px; }
.vs-news-footnote { margin:15px 2px 4px; color:#899493; font-size:10px; line-height:1.5; }
.vs-news-empty { display:grid; justify-items:start; gap:6px; padding:24px 16px; border:1px dashed rgba(255,255,255,.16); border-radius:14px; color:#dce0df; }
.vs-news-empty span { color:#9da7a6; font-size:12px; }
@media (max-width:700px) {
  .vs-phone-modal { max-width:none; width:100%; margin:0; }
  .vs-phone-shell { min-height:100dvh; padding:7px; border-radius:0; }
  .vs-phone-screen { height:calc(100dvh - 54px - env(safe-area-inset-bottom)); min-height:0; border-radius:15px; display:flex; flex-direction:column; }
  .vs-phone-toolbar { flex:0 0 auto; }
  .vs-phone-panel { flex:1 1 auto; min-height:0; overflow-y:auto; padding:12px; }
  .vs-phone-app { min-height:68px; }
  .vs-news-heading h2 { font-size:22px; }
  .vs-news-category { min-height:45px; }
  .vs-news-card { padding:13px; }
  .vs-news-card h3 { font-size:14px; }
  .vs-news-card p { font-size:12px; }
}
@media (min-width:701px) {
  .vs-phone-modal { max-width:480px; }
  .vs-phone-shell { padding:12px; border-radius:25px; }
  .vs-phone-screen { height:min(76dvh,760px); min-height:560px; display:flex; flex-direction:column; }
  .vs-phone-panel { flex:1 1 auto; min-height:0; overflow-y:auto; }
}

/* Mobile viewport fit: one page scroller, phone content owns its scroll. */
@media (max-width:700px) {
  html, body { width:100%; min-height:100%; margin:0; overflow-x:hidden; }
  body { overflow-y:auto; }
  #app { width:100%; min-height:100dvh; }
  .vs-view { box-sizing:border-box; width:100%; min-height:calc(100dvh - 84px); padding:8px 8px calc(12px + env(safe-area-inset-bottom)); overflow:visible; }
  .vs-screen { width:100%; max-width:100%; min-width:0; }
  .vs-phone-modal { width:100%; max-width:100%; margin:0; }
  .vs-phone-shell { box-sizing:border-box; width:100%; min-height:0; padding:0; border:0; border-radius:0; box-shadow:none; background:transparent; }
  .vs-phone-status { display:none; }
  .vs-phone-screen { box-sizing:border-box; width:100%; height:calc(100dvh - 105px - env(safe-area-inset-bottom)); min-height:320px; max-height:none; border-radius:15px; overflow:hidden; display:flex; flex-direction:column; }
  .vs-phone-toolbar { flex:0 0 auto; }
  .vs-phone-panel { box-sizing:border-box; width:100%; flex:1 1 0; min-height:0; height:auto; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; scrollbar-width:thin; }
  .vs-phone-panel > * { min-width:0; max-width:100%; }
  .vs-phone-home { width:100%; }
  .vs-phone-apps { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .vs-phone-app { min-width:0; }
  .vs-phone-tabs,.vs-news-categories { scrollbar-width:none; }
  .vs-phone-tabs::-webkit-scrollbar,.vs-news-categories::-webkit-scrollbar { display:none; }
  /* Prevent the page and nested phone panel from competing as scroll containers. */
  .vs-phone-shell, .vs-phone-screen { overscroll-behavior:contain; }
  .vs-screen:has(.vs-phone-shell) { padding:0; }
}
@media (max-width:380px) {
  .vs-view { padding-left:6px; padding-right:6px; }
  .vs-phone-panel { padding:10px; }
  .vs-phone-app { gap:8px; padding:9px; }
  .vs-phone-app b { flex-basis:34px; width:34px; height:34px; }
}
/* Game controls stay subtle until needed; game remains in the same iframe. */
.vs-game-frame { position:relative; width:100%; min-height:0; }
.vs-game-frame iframe { display:block; width:100%; height:100%; border:0; background:#101414; }
.vs-game-controls { display:flex; align-items:center; justify-content:flex-end; gap:6px; margin:0 0 8px; }
.vs-game-controls button { min-height:34px; padding:6px 10px; border:1px solid rgba(255,255,255,.14); border-radius:10px; background:rgba(28,33,34,.92); color:#f1f3f2; font-size:11px; font-weight:700; }
.vs-game-controls button:hover,.vs-game-controls button:focus-visible { border-color:#f6b34b; color:#ffc66d; }
.vs-screen:has(.vs-game-frame) { display:flex; flex-direction:column; gap:0; }
.vs-screen:has(.vs-game-frame) .vs-game-frame { flex:1 1 auto; }
@media (max-width:700px) {
  .vs-screen:has(.vs-game-frame) { height:calc(100dvh - 100px); min-height:0; padding:0; }
  .vs-game-frame { flex:1 1 auto; min-height:0; height:auto; aspect-ratio:auto !important; }
  .vs-game-frame iframe { position:absolute; inset:0; height:100%; }
  .vs-game-controls { flex:0 0 auto; margin:0 0 6px; }
  .vs-game-controls button { min-height:32px; padding:5px 9px; }
}
.vs-game-fullscreen { position:fixed !important; z-index:10000; inset:0 !important; width:100vw !important; height:100dvh !important; max-width:none !important; margin:0 !important; padding:6px !important; background:#080a0a !important; }
.vs-game-fullscreen .vs-game-frame { height:calc(100dvh - 42px) !important; }
.vs-game-fullscreen .vs-game-controls { margin-bottom:6px; }
.vs-game-fullscreen .vs-game-frame iframe { height:100%; }

/* Definitive phone modal sizing: Bootstrap modal-body must not become a second scroll area. */
#phoneModal .modal-dialog, .vs-phone-modal {
  box-sizing:border-box;
  width:min(100vw,410px);
  max-width:100vw;
  height:100dvh;
  max-height:100dvh;
  margin:0 auto;
}
#phoneModal .modal-content, .vs-phone-modal {
  height:100%;
  min-height:0;
  border:0;
  overflow:hidden;
}
#phoneModal .modal-body {
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  min-height:0;
  height:100%;
  padding:0 !important;
  overflow:hidden !important;
}
#phoneModal .vs-phone-shell {
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  min-height:0;
  height:100%;
  width:100%;
  box-sizing:border-box;
}
#phoneModal .vs-phone-status { flex:0 0 52px; }
#phoneModal .vs-phone-screen {
  display:flex;
  flex:1 1 0;
  flex-direction:column;
  min-height:0;
  height:auto;
  max-height:none;
  overflow:hidden;
}
#phoneModal .vs-phone-toolbar { flex:0 0 47px; }
#phoneModal #phonePanel {
  flex:1 1 0;
  min-height:0;
  height:auto;
  max-height:none;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
@media (max-width:700px) {
  #phoneModal .modal-dialog { width:100vw; height:100dvh; max-height:100dvh; margin:0; }
  #phoneModal .modal-content { border-radius:0; }
  #phoneModal .modal-body { width:100%; }
  #phoneModal .vs-phone-shell { padding:0; border:0; border-radius:0; background:#101414; box-shadow:none; }
  #phoneModal .vs-phone-shell::before { display:none; }
  #phoneModal .vs-phone-screen { border-radius:14px; }
  #phoneModal .vs-phone-status { padding:0 12px; }
}

.vs-arcade-play { display:flex; flex-direction:column; width:100%; height:100%; min-height:0; }
.vs-arcade-play iframe { flex:1 1 auto; width:100%; min-height:320px; height:calc(100dvh - 190px); border:1px solid rgba(255,255,255,.12); border-radius:12px; background:#faf8ef; }
@media (max-width:700px) { .vs-arcade-play iframe { height:calc(100dvh - 190px); min-height:260px; } }

/* Explicit, always-visible phone close control and compact arcade directory. */
.vs-phone-toolbar { position:relative; gap:7px; }
.vs-phone-toolbar #phoneTitle { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:center; }
.vs-phone-toolbar .vs-phone-dot { flex:0 0 7px; }
.vs-phone-close { margin-left:auto; flex:0 0 34px; width:34px; height:34px; border:1px solid rgba(255,255,255,.18); border-radius:10px; color:#fff; background:#343b39; font-size:15px; line-height:1; }
.vs-phone-close:hover,.vs-phone-close:focus-visible { color:#171717; background:#f6b34b; outline:2px solid rgba(246,179,75,.35); }
.vs-phone-power { display:inline-flex !important; align-items:center; justify-content:center; width:36px; height:36px; flex:0 0 36px; position:relative; z-index:2; }
.vs-arcade-list { display:flex; flex-direction:column; gap:8px; }
.vs-arcade-card { display:flex; align-items:center; gap:10px; min-width:0; padding:10px; border:1px solid rgba(255,255,255,.1); border-radius:13px; background:rgba(255,255,255,.035); }
.vs-arcade-icon { display:flex; align-items:center; justify-content:center; flex:0 0 42px; width:42px; height:42px; border-radius:11px; background:rgba(246,179,75,.12); color:#ffc36a; font-weight:900; }
.vs-arcade-copy { display:flex; flex:1 1 auto; flex-direction:column; min-width:0; gap:3px; }
.vs-arcade-copy strong { font-size:13px; }
.vs-arcade-copy small { color:#aeb8b4; font-size:10px; line-height:1.3; }
.vs-arcade-copy span { color:#f6b34b; font-size:10px; }
.vs-arcade-card .btn { flex:0 0 auto; }

/* Keep notification dots decorative so they never intercept modal controls. */
.vs-phone-toolbar .vs-phone-dot { pointer-events:none; }
.vs-phone-close { position:relative; z-index:8; pointer-events:auto; }

/* Final mobile modal override: defeat Bootstrap's centered-dialog sizing and width cap. */
@media (max-width:700px) {
  #phoneModal { padding:0 !important; overflow:hidden !important; }
  #phoneModal .modal-dialog,
  #phoneModal .modal-dialog.modal-dialog-centered,
  #phoneModal .modal-dialog.modal-fullscreen-sm-down {
    position:fixed !important; inset:0 !important; display:flex !important;
    width:100vw !important; max-width:none !important; height:100dvh !important;
    min-height:100dvh !important; margin:0 !important; padding:0 !important;
    transform:none !important;
  }
  #phoneModal .modal-content,
  #phoneModal .modal-content.vs-phone-modal {
    display:flex !important; flex-direction:column !important;
    width:100% !important; max-width:none !important;
    height:100dvh !important; min-height:100dvh !important; max-height:100dvh !important;
    margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important;
  }
  #phoneModal .modal-body {
    flex:1 1 0 !important; width:100% !important; height:auto !important;
    min-height:0 !important; max-height:none !important; padding:0 !important; overflow:hidden !important;
  }
  #phoneModal .vs-phone-shell { flex:1 1 0 !important; width:100% !important; height:100% !important; min-height:0 !important; }
  #phoneModal .vs-phone-screen { flex:1 1 0 !important; width:100% !important; height:auto !important; min-height:0 !important; max-height:none !important; }
  #phoneModal .vs-phone-toolbar { display:flex !important; flex:0 0 52px !important; min-height:52px !important; }
  #phoneModal #phonePanel { flex:1 1 0 !important; min-height:0 !important; height:auto !important; }
}


/* VirtuaSoul handset polish: framed device on desktop and mobile, with discreet hardware details. */
#phoneModal .modal-dialog,
#phoneModal .modal-dialog.modal-dialog-centered,
#phoneModal .modal-dialog.modal-fullscreen-sm-down {
  width:min(440px,100vw) !important; max-width:440px !important;
}
#phoneModal .modal-content,
#phoneModal .modal-content.vs-phone-modal {
  background:transparent !important; overflow:visible !important;
}
#phoneModal .modal-body { background:transparent !important; }
#phoneModal .vs-phone-shell {
  position:relative !important; box-sizing:border-box !important;
  padding:18px 11px 16px !important;
  border:2px solid #343b3a !important; border-radius:36px !important;
  background:linear-gradient(125deg,#303736 0%,#111615 22%,#202625 78%,#090c0c 100%) !important;
  box-shadow:0 22px 70px rgba(0,0,0,.58),inset 0 0 0 2px rgba(255,255,255,.045),inset 0 0 0 5px rgba(0,0,0,.28) !important;
}
#phoneModal .vs-phone-shell::before {
  content:""; display:block !important; position:absolute; z-index:12;
  top:6px; left:50%; transform:translateX(-50%);
  width:72px; height:7px; border-radius:8px;
  background:#050707; box-shadow:inset 0 1px 2px #000,0 0 0 1px rgba(255,255,255,.07);
  pointer-events:none;
}
#phoneModal .vs-phone-shell::after {
  content:""; position:absolute; z-index:12; right:-5px; top:118px;
  width:4px; height:68px; border-radius:0 4px 4px 0;
  background:linear-gradient(90deg,#555e5b,#171b1a);
  box-shadow:0 78px 0 -0.2px #343b39; pointer-events:none;
}
#phoneModal .vs-phone-status { padding-top:2px; }
#phoneModal .vs-phone-screen {
  position:relative; isolation:isolate; border:1px solid rgba(255,255,255,.13) !important;
  border-radius:23px !important; overflow:hidden !important;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.45),0 2px 7px rgba(0,0,0,.24);
}
#phoneModal .vs-phone-screen::after {
  content:""; position:absolute; z-index:30; inset:0; pointer-events:none;
  opacity:0; background:linear-gradient(180deg,transparent 0%,rgba(255,255,255,.045) 49%,transparent 53%);
  animation:vs-phone-screen-flicker 17s infinite;
}
@keyframes vs-phone-screen-flicker {
  0%, 37%, 37.4%, 72%, 72.35%, 100% { opacity:0; }
  37.15%,72.15% { opacity:.7; }
}
#phoneModal .vs-phone-toolbar { border-radius:20px 20px 0 0; }
#phoneModal .vs-phone-panel { scrollbar-color:rgba(246,179,75,.55) transparent; }
#phoneModal .vs-phone-panel::-webkit-scrollbar { width:4px; }
#phoneModal .vs-phone-panel::-webkit-scrollbar-thumb { background:rgba(246,179,75,.52); border-radius:8px; }
@media (max-width:700px) {
  #phoneModal { padding:0 !important; background:rgba(0,0,0,.76) !important; }
  #phoneModal .modal-dialog,
  #phoneModal .modal-dialog.modal-dialog-centered,
  #phoneModal .modal-dialog.modal-fullscreen-sm-down {
    position:fixed !important; inset:0 !important; display:flex !important;
    align-items:center !important; justify-content:center !important;
    width:100vw !important; max-width:none !important; height:100dvh !important;
    min-height:100dvh !important; margin:0 !important; padding:8px 7px !important;
    transform:none !important;
  }
  #phoneModal .modal-content,
  #phoneModal .modal-content.vs-phone-modal {
    display:flex !important; flex-direction:column !important;
    width:min(100%,430px) !important; max-width:430px !important;
    height:calc(100dvh - 16px) !important; min-height:0 !important; max-height:calc(100dvh - 16px) !important;
    margin:0 auto !important; padding:0 !important; border:0 !important; border-radius:36px !important;
    background:transparent !important;
  }
  #phoneModal .modal-body { flex:1 1 0 !important; min-height:0 !important; padding:0 !important; overflow:visible !important; }
  #phoneModal .vs-phone-shell {
    width:100% !important; height:100% !important; min-height:0 !important;
    padding:17px 9px 12px !important; border:2px solid #343b3a !important; border-radius:34px !important;
    background:linear-gradient(125deg,#303736 0%,#111615 22%,#202625 78%,#090c0c 100%) !important;
    box-shadow:0 12px 38px rgba(0,0,0,.48),inset 0 0 0 2px rgba(255,255,255,.045),inset 0 0 0 5px rgba(0,0,0,.28) !important;
  }
  #phoneModal .vs-phone-shell::before { display:block !important; }
  #phoneModal .vs-phone-shell::after { display:block !important; }
  #phoneModal .vs-phone-status { flex:0 0 43px !important; min-height:43px; }
  #phoneModal .vs-phone-screen { flex:1 1 0 !important; min-height:0 !important; height:auto !important; border-radius:22px !important; }
  #phoneModal .vs-phone-toolbar { flex:0 0 49px !important; min-height:49px !important; }
}
@media (prefers-reduced-motion:reduce) {
  #phoneModal .vs-phone-screen::after { animation:none !important; }
}

/* QA polish: prevent 1–3px horizontal overflow from handset borders and nested flex items. */
#phoneModal, #phoneModal .modal-dialog, #phoneModal .modal-content, #phoneModal .modal-body, #phoneModal .vs-phone-shell, #phoneModal .vs-phone-screen, #phoneModal .vs-phone-panel { box-sizing:border-box !important; min-width:0 !important; }
#phoneModal .vs-phone-shell, #phoneModal .vs-phone-screen { max-width:100% !important; }
#phoneModal .vs-phone-screen { width:100% !important; }
#phoneModal .vs-phone-toolbar > *, #phoneModal .vs-phone-panel > * { min-width:0; }
#phoneModal .vs-chat-conversation { display:flex; flex-direction:column; min-height:0; height:100%; overflow:hidden; }
#phoneModal .vs-chat-messages { flex:1 1 auto; min-height:0; overflow-y:auto; scroll-behavior:auto; }
#phoneModal .vs-chat-conversation > .input-group { flex:0 0 auto; }

/* Desktop handset centring and physical side-key overflow correction. */
#phoneModal .vs-phone-shell::after { right:-2px !important; }
@media (min-width:701px) {
  #phoneModal .modal-dialog, #phoneModal .modal-dialog.modal-dialog-centered, #phoneModal .modal-dialog.modal-fullscreen-sm-down { width:min(440px,calc(100vw - 32px)) !important; max-width:440px !important; height:auto !important; min-height:0 !important; max-height:94dvh !important; margin:3dvh auto !important; padding:0 !important; transform:none !important; display:flex !important; align-items:center !important; }
  #phoneModal .modal-content, #phoneModal .modal-content.vs-phone-modal { width:100% !important; height:auto !important; min-height:0 !important; max-height:94dvh !important; margin:0 !important; }
  #phoneModal .modal-body { min-height:0 !important; max-height:94dvh !important; overflow:visible !important; }
  #phoneModal .vs-phone-shell { height:auto !important; min-height:0 !important; max-height:94dvh !important; }
  #phoneModal .vs-phone-screen { height:min(680px,calc(94dvh - 115px)) !important; min-height:380px !important; }
  #phoneModal .vs-phone-panel { max-height:calc(94dvh - 180px) !important; }
}

/* Game status belongs beside the host's display controls, never floating over gameplay. */
.vs-game-controls { align-items:center; }
.vs-game-ready-status { margin-right:auto; color:#9ca8a4; font-size:10px; font-weight:800; letter-spacing:.045em; white-space:nowrap; }
.vs-game-ready-status.is-ready { color:#8fdaa7; }
.vs-game-ready-status.is-error { color:#ff9b83; }
.vs-game-controls button { flex:0 0 auto; }
@media(max-width:480px){ .vs-game-ready-status{font-size:9px;max-width:36%;overflow:hidden;text-overflow:ellipsis;} .vs-game-controls{gap:4px;} .vs-game-controls button{padding:5px 7px;font-size:10px;} }
