/* Persistent MJX AI Supporter. Kept separate from regulations and navigation styles. */
#mjx-ai-float-root,
#mjx-ai-float-root * { box-sizing:border-box; }
#mjx-ai-float-root {
  position:fixed;
  z-index:9000;
  left:max(18px, env(safe-area-inset-left));
  bottom:calc(18px + env(safe-area-inset-bottom));
  font-family:Inter,"Noto Sans JP",-apple-system,BlinkMacSystemFont,"Hiragino Kaku Gothic ProN",sans-serif;
  font-size:14px;
  line-height:1.45;
  pointer-events:none;
  color:#1d2a3d;
}
#mjx-ai-float-root button { font:inherit; cursor:pointer; }
#mjx-ai-float-root a { font:inherit; }
#mjx-ai-float-root :is(button,a):focus-visible { outline:3px solid #f7be6c; outline-offset:3px; }
#mjx-ai-float-root .mjx-ai-float-launcher {
  position:relative;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:9px;
  min-height:52px;
  min-width:54px;
  margin:0;
  padding:12px 17px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:100px;
  background:#b40056;
  color:#fff;
  box-shadow:0 7px 24px rgba(79,12,42,.28);
  font-size:13px;
  font-weight:750;
  line-height:1.35;
  white-space:nowrap;
  -webkit-tap-highlight-color:transparent;
  pointer-events:auto;
  transition:background-color .2s,transform .2s,box-shadow .2s;
}
#mjx-ai-float-root .mjx-ai-float-launcher:hover {
  background:#920047;
  transform:translateY(-2px);
  box-shadow:0 12px 27px rgba(79,12,42,.32);
}
#mjx-ai-float-root .mjx-ai-float-launcher svg { display:block; width:22px; height:22px; flex-shrink:0; }
#mjx-ai-float-root .mjx-ai-float-panel {
  position:absolute;
  left:0;
  bottom:calc(100% + 12px);
  display:flex;
  flex-direction:column;
  width:min(480px,calc(100vw - 36px));
  height:min(700px,calc(100vh - 120px));
  height:min(700px,calc(100dvh - 120px - env(safe-area-inset-top)));
  min-height:200px;
  overflow:hidden;
  border:1px solid #e1e5ed;
  border-radius:18px;
  background:#fff;
  box-shadow:0 24px 70px rgba(23,36,57,.23);
  pointer-events:auto;
}
#mjx-ai-float-root .mjx-ai-float-panel[hidden] { display:none!important; }
#mjx-ai-float-root .mjx-ai-float-header {
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-height:56px;
  padding:9px 14px;
  border-bottom:1px solid #e7eaf0;
  background:#fff;
}
#mjx-ai-float-root .mjx-ai-float-identity {
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
#mjx-ai-float-root .mjx-ai-float-identity div { display:flex;flex-direction:column;min-width:0;gap:2px; }
#mjx-ai-float-root .mjx-ai-float-identity strong {
  color:#202a3d;
  font-size:14px;
  font-weight:800;
  line-height:1.25;
}
#mjx-ai-float-root .mjx-ai-float-identity span { color:#65738a; font-size:11px; }
#mjx-ai-float-root .mjx-ai-float-actions { display:flex; align-items:center; gap:7px; flex-shrink:0; }
#mjx-ai-float-root .mjx-ai-float-actions a {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:44px;
  min-height:42px;
  color:#8e0a48;
  text-decoration:none;
  font-size:12px;
  font-weight:700;
  border-radius:9px;
}
#mjx-ai-float-root .mjx-ai-float-actions a:hover { background:#f9eaf1; }
#mjx-ai-float-root .mjx-ai-float-close {
  display:inline-flex;
  justify-content:center;
  align-items:center;
  width:42px;
  height:42px;
  margin:0;
  border:0;
  border-radius:10px;
  background:#f3f4f7;
  color:#24334a;
  font-size:26px;
  line-height:1;
}
#mjx-ai-float-root .mjx-ai-float-close:hover { background:#e8eaf0; }
#mjx-ai-float-root .mjx-ai-float-content {
  display:flex;
  flex:1;
  min-height:0;
  flex-direction:column;
  background:#fff;
}
#mjx-ai-float-root .mjx-ai-float-loader {
  padding:14px;
  color:#5a6981;
  font-size:13px;
  text-align:center;
}
#mjx-ai-float-root .mjx-ai-float-loader[hidden] { display:none; }
#mjx-ai-float-root .mjx-ai-float-iframe {
  display:block;
  flex:1;
  width:100%;
  height:100%;
  min-height:0;
  border:0;
  background:#fff;
}
@media(max-width:600px) {
  #mjx-ai-float-root { left:max(12px,env(safe-area-inset-left)); bottom:calc(12px + env(safe-area-inset-bottom)); }
  #mjx-ai-float-root .mjx-ai-float-launcher { min-height:50px; padding:11px 15px; }
  #mjx-ai-float-root .mjx-ai-float-panel {
    position:fixed;
    top:auto;
    right:auto;
    bottom:calc(74px + env(safe-area-inset-bottom));
    left:max(10px,env(safe-area-inset-left));
    width:min(460px,calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    height:min(560px,64dvh);
    max-height:calc(100dvh - 94px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height:180px;
    border-radius:16px;
  }
  /* Underlying site stays interactive and scrollable behind the nonmodal chat. */
}
@media(max-width:360px) {
  #mjx-ai-float-root .mjx-ai-float-header { padding:10px; }
  #mjx-ai-float-root .mjx-ai-float-actions { gap:2px; }
}
@media(prefers-reduced-motion:reduce) {
  #mjx-ai-float-root .mjx-ai-float-launcher { transition:none; }
}
@media print { #mjx-ai-float-root { display:none!important; } }


/* More room for long rule explanations, with an optional near-fullscreen view. */
#mjx-ai-float-root .mjx-ai-float-expand {
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:10px;
  background:transparent;
  color:#35445f;
  font-size:19px;
  font-weight:700;
}
#mjx-ai-float-root .mjx-ai-float-expand:hover,
#mjx-ai-float-root .mjx-ai-float-expand[aria-pressed="true"] {
  background:#f3e5ed;
  color:#970849;
}
#mjx-ai-float-root.mjx-ai-float-maximized .mjx-ai-float-panel {
  position:fixed;
  top:max(20px,env(safe-area-inset-top));
  right:max(20px,env(safe-area-inset-right));
  bottom:max(20px,env(safe-area-inset-bottom));
  left:max(20px,env(safe-area-inset-left));
  width:auto;
  height:auto;
  max-height:none;
  min-height:0;
}
@media(max-width:600px) {
  #mjx-ai-float-root .mjx-ai-float-expand {display:none}
  #mjx-ai-float-root.mjx-ai-float-maximized .mjx-ai-float-panel {
    top:auto;
    right:auto;
    bottom:calc(74px + env(safe-area-inset-bottom));
    left:max(10px,env(safe-area-inset-left));
    width:min(460px,calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    height:min(560px,64dvh);
    max-height:calc(100dvh - 94px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}


/* Calm micro-interactions. The panel keeps its established compact dimensions. */
#mjx-ai-float-root .mjx-ai-float-launcher {
  animation:mjx-ai-launcher-arrive 420ms cubic-bezier(.2,.8,.2,1) backwards;
}
#mjx-ai-float-root .mjx-ai-float-launcher svg {
  transition:transform 220ms ease;
}
#mjx-ai-float-root .mjx-ai-float-launcher[aria-expanded="true"] {
  background:#98034b;
  box-shadow:0 9px 27px rgba(79,12,42,.32);
}
#mjx-ai-float-root .mjx-ai-float-panel:not([hidden]) {
  transform-origin:left bottom;
  animation:mjx-ai-panel-enter 270ms cubic-bezier(.2,.8,.2,1) both;
}
#mjx-ai-float-root .mjx-ai-float-panel.mjx-ai-float-closing {
  animation:mjx-ai-panel-leave 180ms ease-in both;
  pointer-events:none;
}
#mjx-ai-float-root .mjx-ai-float-actions :is(a,button) {
  transition:background-color 170ms ease,color 170ms ease,transform 170ms ease;
}
#mjx-ai-float-root .mjx-ai-float-actions :is(a,button):active {
  transform:scale(.95);
}
@media(hover:hover) {
  #mjx-ai-float-root .mjx-ai-float-launcher:hover svg {
    transform:rotate(-9deg) scale(1.07);
  }
}
#mjx-ai-float-root .mjx-ai-float-launcher:active {
  transform:translateY(0) scale(.97);
}
@keyframes mjx-ai-launcher-arrive {
  from {opacity:0;transform:translateY(10px) scale(.96)}
  to {opacity:1;transform:translateY(0) scale(1)}
}
@keyframes mjx-ai-panel-enter {
  from {opacity:0;transform:translateY(12px) scale(.985)}
  to {opacity:1;transform:translateY(0) scale(1)}
}
@keyframes mjx-ai-panel-leave {
  from {opacity:1;transform:translateY(0) scale(1)}
  to {opacity:0;transform:translateY(8px) scale(.99)}
}
@media(prefers-reduced-motion:reduce) {
  #mjx-ai-float-root .mjx-ai-float-launcher,
  #mjx-ai-float-root .mjx-ai-float-panel:not([hidden]),
  #mjx-ai-float-root .mjx-ai-float-panel.mjx-ai-float-closing {
    animation:none!important;
    transform:none!important;
  }
  #mjx-ai-float-root .mjx-ai-float-launcher svg,
  #mjx-ai-float-root .mjx-ai-float-actions :is(a,button) {
    transition:none!important;
  }
}
