/* Nahang temporary refinement / site-wide, narrowly scoped mobile controls.
   Keep the existing accessibility and catalog buttons functional and tappable. */
@media (max-width: 767px) {
  :root {
    --nh-refine-dock-left: max(5px, env(safe-area-inset-left, 0px));
    --nh-refine-dock-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  /* A vertical edge dock occupies one 44px column, not two adjacent columns. */
  .nh-accessibility[data-nh-a11y] {
    left: var(--nh-refine-dock-left) !important;
    right: auto !important;
    bottom: calc(var(--nh-refine-dock-bottom) + 52px) !important;
  }
  .nhc-explorer-launch[data-nhc-toggle] {
    left: var(--nh-refine-dock-left) !important;
    right: auto !important;
    bottom: var(--nh-refine-dock-bottom) !important;
  }

  .nh-accessibility-toggle,
  .nhc-explorer-launch[data-nhc-toggle] {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  /* The settings dialog opens inward into the viewport, never off-screen. */
  .nh-accessibility[data-nh-a11y] > section {
    left: 0 !important;
    right: auto !important;
    width: min(325px, calc(100vw - 12px)) !important;
    max-height: calc(100dvh - 152px);
  }

  /* Anchor targets near the end of a page clear the fixed mobile dock. */
  html { scroll-padding-bottom: 104px; }
}

/* Stage 05 / Windows-inspired glass entrance. No network request or forced hold;
   blur lives on a short-lived compositor layer. Every click passes through. */
#nhr-startup {
  position: fixed;
  z-index: 2147482000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top, 0px)) max(15px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px));
  color: #f4f9ff;
  background: rgb(5 15 30 / .38);
  --nhr-startup-blur: 7px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s cubic-bezier(.18,.8,.22,1), visibility .28s;
  -webkit-backdrop-filter: blur(var(--nhr-startup-blur));
  backdrop-filter: blur(var(--nhr-startup-blur));
}
#nhr-startup[data-blur="off"] { --nhr-startup-blur: 0px; }
#nhr-startup[data-blur="soft"] { --nhr-startup-blur: 3px; }
#nhr-startup[data-blur="strong"] { --nhr-startup-blur: 10px; }
html.nhr-booting #nhr-startup {
  visibility: visible;
  opacity: 1;
}
#nhr-startup .nhr-startup-panel {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 13px;
  width: min(440px, calc(100vw - 32px));
  min-height: 260px;
  padding: 28px 28px 34px;
  overflow: hidden;
  border: 1px solid rgb(140 200 255 / .28);
  border-radius: clamp(20px, 4.2vw, 30px);
  background: linear-gradient(147deg, rgb(25 57 98 / .94), rgb(7 23 45 / .96) 78%);
  box-shadow: 0 30px 85px rgb(0 8 26 / .27), inset 0 1px 0 rgb(220 242 255 / .12);
  text-align: center;
  font-family: inherit;
}
#nhr-startup .nhr-startup-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 90px;
  background: radial-gradient(ellipse at 50% 0, rgb(76 166 255 / .21), transparent 72%);
  pointer-events: none;
}
#nhr-startup .nhr-startup-badge { position: relative; display: grid; place-items: center; width: 62px; height: 62px; }
#nhr-startup .nhr-startup-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgb(135 206 255 / .46);
  border-radius: 17px;
  color: #a4ddff;
  background: linear-gradient(140deg, rgb(33 123 244 / .27), rgb(22 82 177 / .11));
  box-shadow: inset 0 1px 0 rgb(220 242 255 / .2);
  font: 850 23px/1 system-ui,sans-serif;
  letter-spacing: -.08em;
}
#nhr-startup .nhr-startup-orbit {
  position: absolute;
  inset: -2px;
  border: 2px solid rgb(113 194 255 / .16);
  border-block-start-color: #65c7ff;
  border-radius: 50%;
  animation: nhr-spin 1.4s linear infinite;
}
#nhr-startup .nhr-startup-label {
  color: #91c7fa;
  font: 700 10px/1.5 system-ui,sans-serif;
  letter-spacing: .18em;
  direction: ltr;
}
#nhr-startup .nhr-startup-label i { display: inline-block; width: 4px; height: 4px; margin: 0 5px 2px; border-radius: 50%; background: #6ee0ff; }
#nhr-startup .nhr-startup-copy { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#nhr-startup .nhr-startup-copy strong {
  font-size: clamp(19px, 5.6vw, 25px);
  font-weight: 800;
  line-height: 1.35;
}
#nhr-startup .nhr-startup-copy small {
  color: #c0d6ef;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.8;
  max-width: 34ch;
}
#nhr-startup .nhr-startup-state { display: flex; align-items: center; gap: 10px; margin-top: 4px; color: #91b9dc; font-size: 10px; }
#nhr-startup .nhr-startup-dots { display: flex; align-items: center; gap: 4px; direction: ltr; }
#nhr-startup .nhr-startup-dots b { width: 4px; height: 4px; border-radius: 50%; background: #68c9ff; animation: nhr-dot .8s ease-in-out infinite alternate; }
#nhr-startup .nhr-startup-dots b:nth-child(2) { animation-delay: .15s; }
#nhr-startup .nhr-startup-dots b:nth-child(3) { animation-delay: .3s; }
@keyframes nhr-dot { to { opacity: .24; transform: translateY(-3px); } }
#nhr-startup .nhr-startup-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1877fa, #69ccff 60%, #2978ea);
  transform: scaleX(.04);
  transform-origin: right;
}
html.nhr-booting #nhr-startup .nhr-startup-progress {
  animation: nhr-startup-progress 1.3s ease-out both;
}
@keyframes nhr-startup-progress {
  from { transform: scaleX(.04); }
  to { transform: scaleX(1); }
}
html.nhr-arrived .nhp-app .nhp-hero { animation: nhr-hero-arrive .45s ease-out both; }
@keyframes nhr-hero-arrive { from { opacity: .82; } to { opacity: 1; } }

/* Tiny action state beside a mouse; at the bottom on touch screens. */
#nhr-action-feedback {
  position: fixed;
  z-index: 2147482001;
  top: var(--nhr-pointer-y, 20px);
  left: var(--nhr-pointer-x, 20px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  width: max-content;
  max-width: min(250px, calc(100vw - 24px));
  padding: 8px 12px;
  direction: rtl;
  border: 1px solid rgb(111 181 255 / .25);
  border-radius: 12px;
  color: #f2f8ff;
  background: #0a1b33;
  box-shadow: 0 7px 22px rgb(0 0 0 / .14);
  font-size: 11px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .14s ease, visibility .14s ease;
}
#nhr-action-feedback[data-visible="true"] { opacity: 1; visibility: visible; }
#nhr-action-feedback .nhr-action-spinner {
  display: block;
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  border: 2px solid rgb(129 199 255 / .22);
  border-top-color: #6eb6ff;
  border-radius: 50%;
  animation: nhr-spin .8s linear infinite;
}
@keyframes nhr-spin { to { rotate: 360deg; } }
#nhr-action-feedback:not([data-cursor="true"]) {
  top: auto;
  left: 50%;
  bottom: max(82px, calc(env(safe-area-inset-bottom, 0px) + 72px));
  transform: translateX(-50%);
}
html[data-nh-theme="light"] #nhr-action-feedback {
  background: linear-gradient(135deg, #f9fcff, #eaf4ff);
  color: #123355;
  border-color: rgb(21 101 255 / .18);
  box-shadow: 0 9px 26px rgb(20 61 112 / .1);
}
html[data-nh-theme="light"] #nhr-startup { background: rgb(229 241 253 / .42); }
html[data-nh-theme="light"] #nhr-startup .nhr-startup-panel {
  color: #0b315b;
  border-color: rgb(38 119 201 / .21);
  background: linear-gradient(140deg, rgb(255 255 255 / .97), rgb(229 242 255 / .97));
  box-shadow: 0 22px 76px rgb(36 101 158 / .16), inset 0 1px 0 #fff;
}
html[data-nh-theme="light"] #nhr-startup .nhr-startup-copy small,
html[data-nh-theme="light"] #nhr-startup .nhr-startup-state { color: #52769a; }
html[data-nh-theme="light"] #nhr-startup .nhr-startup-mark { color: #246bc4; }
html[data-nh-theme="light"] #nhr-startup .nhr-startup-label { color: #3975b3; }
@media (hover: none), (pointer: coarse) {
  #nhr-action-feedback {
    top: auto;
    left: 50%;
    bottom: max(82px, calc(env(safe-area-inset-bottom, 0px) + 72px));
    transform: translateX(-50%);
  }
}
@media (max-width: 767px) {
  #nhr-startup .nhr-startup-panel { min-height: 235px; padding: 24px 18px 28px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #nhr-startup, #nhr-action-feedback { transition: none; }
  #nhr-startup .nhr-startup-progress, #nhr-startup .nhr-startup-orbit,
  #nhr-startup .nhr-startup-dots b, #nhr-action-feedback .nhr-action-spinner {
    animation: none !important;
  }
  html.nhr-arrived .nhp-app .nhp-hero { animation: none !important; }
}

/* Context shortcuts, enabled explicitly per guest/customer audience in Tools. */
#nhr-context-menu {
  position: fixed;
  z-index: 2147482002;
  display: none;
  width: 190px;
  padding: 7px;
  background: #0e2039;
  border: 1px solid rgb(127 190 255 / .26);
  border-radius: 15px;
  box-shadow: 0 14px 42px rgb(0 5 17 / .24);
  color: #eff7ff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
#nhr-context-menu[data-open="true"] { display: grid; gap: 3px; }
#nhr-context-menu a { display: flex; align-items: center; min-height: 40px; padding: 8px 12px; color: inherit; border-radius: 9px; text-decoration: none; }
#nhr-context-menu a:hover, #nhr-context-menu a:focus-visible { color: #fff; background: rgb(46 129 239 / .29); outline: 1px solid #69b6ff; }
html[data-nh-theme="light"] #nhr-context-menu { background: #f4faff; color: #1b416b; box-shadow: 0 14px 42px rgb(25 83 145 / .15); }
html[data-nh-theme="light"] #nhr-context-menu a:hover, html[data-nh-theme="light"] #nhr-context-menu a:focus-visible { color: #13457f; }
