/* Phone controls surround the workspace; rendering settings remain user-owned. */
.neko-mobile-tools, .neko-mobile-tools * { box-sizing: border-box; }
.neko-mobile-tools { -webkit-touch-callout: none; }
.neko-mobile-tools {
  position: absolute; z-index: 12; left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom));
  margin: 0 auto; max-width: 620px; background: #171e29f5; color: #e5eaf2;
  border: 1px solid #38475d; border-radius: 12px; padding: 6px;
  font: 13px/1.4 system-ui, -apple-system, sans-serif; box-shadow: 0 4px 24px #0005;
  touch-action: manipulation; transition: border-color .15s;
}
.neko-mobile-tools button {
  appearance: none; -webkit-appearance: none; cursor: pointer; color: #dce7f8;
  background: #252f3f; border: 1px solid transparent; border-radius: 7px;
  min-height: 44px; padding: 7px 8px; margin: 0; font: inherit; white-space: nowrap;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.neko-mobile-tools button[aria-pressed=true] { background: #24466e; border-color: #6498f5; color: #fff; }
.neko-mobile-tools button:disabled { opacity: .42; cursor: default; }
.neko-mobile-tools button:active:not(:disabled) { background: #3e5574; }
.neko-mobile-tools button:focus-visible, .nm-text:focus-visible { outline: 2px solid #91b9ff; outline-offset: 1px; }
.nm-top, .nm-row { display: flex; align-items: center; gap: 5px; }
.nm-top { margin-bottom: 5px; }
.nm-top { min-width: 0; }
.nm-has-control .nm-status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.nm-quick { scrollbar-width: none; }
.nm-quick::-webkit-scrollbar { display: none; }
.nm-top > button { flex-shrink: 0; }
.nm-field { display: block; width: 100%; margin: 5px 0 8px; padding: 8px; font: 16px/1.4 system-ui; color: #edf3fc; background: #101722; border: 1px solid #425573; border-radius: 6px; user-select: text; -webkit-user-select: text; touch-action: auto; }
.nm-custom-list .nm-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nm-row { flex-wrap: wrap; }
.nm-status { flex: 1; color: #9bb3d2; padding-left: 5px; font-size: 12px; }
.nm-actions { display: grid; grid-template-columns: 1.3fr repeat(5, 1fr); gap: 4px; }
.nm-drawer { border-top: 1px solid #38475d; margin-top: 7px; padding-top: 7px; max-height: min(42vh, 300px, max(40px, calc(var(--nm-viewport, 100dvh) - 200px))); overflow-y: auto; overscroll-behavior: contain; }
.neko-mobile-tools [hidden] { display: none !important; }
.nm-row { margin-bottom: 5px; }
.nm-keys { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0; }
.nm-keys button { flex: 1 0 auto; min-width: 44px; }
.nm-help { color: #a4b4c9; font-size: 12px; margin: 7px 3px 2px; white-space: normal; }
.nm-text { display: block; resize: vertical; width: 100%; min-height: 66px; margin: 7px 0; padding: 9px; color: #edf3fc; background: #101722; border: 1px solid #425573; border-radius: 6px; font: 16px/1.4 system-ui; }
.nm-text { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; touch-action: auto; }
.nm-notice { position: absolute; left: 8px; right: 68px; bottom: calc(100% + 8px); border-radius: 7px; background: #172943; color: #fff; border: 1px solid #4c6c97; padding: 10px; pointer-events: none; overflow-wrap: anywhere; }
.nm-compact { left: auto; width: auto; }
.nm-compact .nm-actions, .nm-compact .nm-status, .nm-compact [data-action=control] { display: none; }
.nm-compact .nm-quick, .nm-compact [data-action=audio], .nm-compact [data-action=play] { display: none; }
.nm-compact .nm-top { margin-bottom: 0; }
.neko-mobile-cursor { position: absolute; z-index: 9; width: 20px; height: 24px; pointer-events: none; transform: translate(-2px, -2px); filter: drop-shadow(0 1px 2px #0009); }
.neko-mobile-cursor svg { width: 100%; height: 100%; fill: #78adff; stroke: #fff; stroke-width: 1.6px; }
.neko-mobile-cursor[hidden] { display: none; }
body.neko-mobile-active textarea.overlay { touch-action: none; -webkit-user-select: none; user-select: none; }
body.neko-mobile-active { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body.neko-mobile-active #neko { position: fixed; left: 0; right: 0; top: var(--nm-top, 0px); height: var(--nm-viewport, 100dvh) !important; min-height: 0 !important; }
body.neko-mobile-active .neko-main { height: 100% !important; min-height: 0 !important; min-width: 0 !important; width: 100%; }
body.neko-mobile-active .video-container { position: relative; min-height: 0; }
body.neko-mobile-active .video .player { position: relative !important; width: 100% !important; height: 100% !important; padding-bottom: var(--nm-reserve, 116px); box-sizing: border-box; }
body.neko-mobile-active .video .player { touch-action: none; -webkit-user-select: none; user-select: none; overflow: hidden; }
body.neko-mobile-active .video .player::after { content: ''; position: absolute; z-index: 10; bottom: 0; left: 0; right: 0; height: var(--nm-reserve, 116px); background: #0b1018; pointer-events: none; }
body.neko-mobile-active .video .player .video-menu { z-index: 11; }
.nm-panning .overlay { cursor: grab; }
body.neko-mobile-active .video .player-container { flex-shrink: 0; }
body.neko-mobile-active .video .player .video-menu { right: max(10px, env(safe-area-inset-right)); }
body.neko-mobile-active .video .player .video-menu.top { top: 8px; }
body.neko-mobile-active .video .player .video-menu.bottom { bottom: calc(var(--nm-reserve, 116px) + 8px); }
body.neko-mobile-active .video .player .video-menu.bottom .extra-control,
body.neko-mobile-active .video .player .video-menu.top .extra-control { display: none; }
body.neko-mobile-active .video .player .video-menu li i { width: 44px; height: 44px; line-height: 44px; }
body.neko-mobile-active .header-container { flex-shrink: 0; }
body.neko-mobile-active .room-container { display: none !important; }
body.neko-mobile-active .neko-menu { max-width: 100vw; }
body.neko-mobile-active #neko.expanded .neko-menu { position: fixed; z-index: 30; left: 0; top: 44px; width: 100% !important; height: calc(var(--nm-viewport, 100dvh) - 44px) !important; }
body.neko-mobile-active .header-container, body.neko-mobile-active .header { height: 44px !important; }
body.neko-mobile-active .header .menu li i { width: 40px !important; height: 36px !important; line-height: 36px !important; }
body.neko-mobile-immersive .header-container, body.neko-mobile-immersive .room-container { display: none !important; }
body.neko-mobile-immersive .video-container { height: 100% !important; }
@media (orientation: landscape) and (max-height: 560px) {
  .neko-mobile-tools { max-width: 820px; padding: 5px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .nm-top { grid-column: 1; grid-row: 1; margin: 0; }
  .nm-top .nm-status { display: none; }
  .nm-actions { grid-column: 1; grid-row: 2; display: flex; }
  .nm-actions button { flex: 1; }
  .nm-drawer { grid-column: 1 / -1; grid-row: 3; max-height: min(45vh, max(40px, calc(var(--nm-viewport, 100dvh) - 120px))); }
  .nm-compact { display: block; }
  body.neko-mobile-active .room-container { height: 54px !important; }
}
@media (prefers-reduced-motion: reduce) { .neko-mobile-tools { transition: none; } }
.nm-keybar { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; }
.nm-keyscroll { display: flex; flex: 1; min-width: 0; gap: 4px; overflow-x: auto; overscroll-behavior: contain; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.nm-keyscroll button { flex: 0 0 auto; min-width: 44px; }
.nm-keyboard-active { display: block; }
.nm-keyboard-active .nm-top, .nm-keyboard-active .nm-actions { display: none; }
.nm-keyboard-active .nm-keybar { grid-column: 1 / -1; }
/* Keep the actual upstream keyboard listener, but put its focus target beside
   the keyboard toolbar. Focusing a full-video textarea makes iOS pan the page. */
body.neko-mobile-keyboard textarea.overlay {
  position: fixed !important; inset: auto !important; left: 8px !important;
  top: calc(var(--nm-top, 0px) + var(--nm-viewport, 100dvh) - 60px) !important;
  width: 1px !important; height: 1px !important; min-height: 0 !important;
  padding: 0 !important; margin: 0 !important; opacity: .01; font-size: 16px;
}
body.neko-mobile-keyboard .header-container { display: none !important; }
body.neko-mobile-keyboard .video-container { height: 100% !important; }
body.neko-mobile-keyboard .video-menu { display: none !important; }
