/* ==========================================================================
   BRAINIX LP // LIVE SIMULATOR DOM ZONE V2.1 LUXURY SYNC
   Strictly scoped to #brainix-live-unit and #app-shell (Zero impact on LP)
   - Unclips STEP 2 guide bubble (overflow: visible + high z-index)
   - 60fps smooth neon laser progress bar for AI CROSS & EXECUTE
   ========================================================================== */

#app-shell,
#app-shell[data-theme="crimson"],
#app-shell[data-theme="arctic"] {
  --bg-core: #040407 !important;
  --bg-panel: #08080e !important;
  --bg-panel-alt: #0d0d16 !important;
  --bg-card: #10101a !important;
  --bg-card-hover: #161424 !important;
  --bg-input: #06060b !important;
  --bg-glass: rgba(10, 10, 17, 0.94) !important;
  --text-main: #f6f6fb !important;
  --text-sub: #b4bad0 !important;
  --text-muted: #6e758e !important;
  --accent-main: #ff004c !important;
  --accent-main-dim: rgba(255, 0, 76, 0.16) !important;
  --accent-main-glow: rgba(255, 0, 76, 0.42) !important;
  --accent-sub: #ff2a85 !important;
  --accent-sub-dim: rgba(255, 42, 133, 0.16) !important;
  --accent-emerald: #00f0ff !important;
  --border-dim: rgba(255, 255, 255, 0.075) !important;
  --border-mid: rgba(255, 0, 76, 0.32) !important;
  --bnx-viscous: cubic-bezier(0.16, 1, 0.3, 1);
  --bnx-grad-exec: linear-gradient(135deg, #ff004c 0%, #c80064 52%, #7a1aff 100%);
  --bnx-grid-14: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-color: #040407 !important;
  background-image:
    radial-gradient(95% 75% at 12% 0%, rgba(255, 0, 76, 0.085), transparent 58%),
    radial-gradient(85% 65% at 88% 100%, rgba(122, 26, 255, 0.065), transparent 62%),
    #040407 !important;
  color: #f6f6fb !important;
}

/* 1. ライト/ダーク切替ボタン2箇所を完全撤去 */
#lp-theme-switch-btn,
#sim-hdr-theme-btn,
#brainix-live-unit .sim-toolbar-right {
  display: none !important;
}

@keyframes bnxSimFluidIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

#app-shell .bnx-view-entering {
  animation: bnxSimFluidIn 0.52s var(--bnx-viscous) both !important;
}

/* 2. LIVE SIMULATOR 上部スイッチャーバー（#brainix-live-unit）の高級化 */
#brainix-live-unit.sim-stage-toolbar {
  background: linear-gradient(180deg, rgba(16, 12, 22, 0.96) 0%, rgba(9, 8, 14, 0.98) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  border-left: 3px solid #ff004c !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

#brainix-live-unit .sim-step-badge {
  background: rgba(255, 0, 76, 0.16) !important;
  border: 1px solid rgba(255, 42, 117, 0.55) !important;
  color: #ffdce8 !important;
  font-weight: 900 !important;
  letter-spacing: 0.14em !important;
  box-shadow: 0 0 14px rgba(255, 0, 76, 0.25) !important;
}

#brainix-live-unit .sim-mode-btn {
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: linear-gradient(180deg, #161422 0%, #0d0c15 100%) !important;
  color: #d8dce8 !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  transition:
    transform 0.42s var(--bnx-viscous),
    border-color 0.42s var(--bnx-viscous),
    background 0.42s var(--bnx-viscous),
    box-shadow 0.42s var(--bnx-viscous),
    color 0.42s var(--bnx-viscous) !important;
}

#brainix-live-unit .sim-mode-btn:hover {
  transform: translateY(-1.5px) !important;
  border-color: rgba(255, 42, 117, 0.65) !important;
  background: linear-gradient(180deg, #241528 0%, #140e1c 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 0, 76, 0.24) !important;
}

#brainix-live-unit .sim-mode-btn.active {
  border-color: rgba(255, 140, 185, 0.85) !important;
  background: var(--bnx-grad-exec) !important;
  color: #ffffff !important;
  box-shadow:
    0 8px 24px rgba(255, 0, 76, 0.45),
    0 0 18px rgba(122, 26, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.38) !important;
}

/* 3. シミュレーター内ヘッダー＆鮮明3Dクリスタル「B」ロゴ */
#app-shell .top-header {
  height: 50px !important;
  background: linear-gradient(180deg, #0c0a14 0%, #07070c 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.72) !important;
}

#app-shell .top-header::after {
  width: 340px !important;
  height: 2px !important;
  background: linear-gradient(90deg, #ff004c 0%, #ff2a75 45%, #7a1aff 80%, transparent 100%) !important;
  box-shadow: 0 0 16px rgba(255, 0, 76, 0.65) !important;
}

#app-shell .brand-emblem {
  position: relative !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  background: linear-gradient(145deg, #2a0818 0%, #0d0712 58%, #1f0614 100%) !important;
  border: 1px solid rgba(255, 42, 117, 0.78) !important;
  box-shadow:
    0 0 0 1px rgba(255, 0, 76, 0.22),
    0 4px 16px rgba(255, 0, 76, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 12px rgba(255, 0, 76, 0.38) !important;
  color: #ffffff !important;
  font-family: 'Inter', 'Segoe UI', sans-serif !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.75), 0 0 18px rgba(255, 0, 76, 0.95) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#app-shell .brand-name {
  font-size: 16px !important;
  font-weight: 900 !important;
  letter-spacing: 0.16em !important;
  color: #ffffff !important;
}

#app-shell .brand-name span.accent {
  color: #ff1a66 !important;
  text-shadow: 0 0 14px rgba(255, 0, 76, 0.65) !important;
}

/* 4. シミュレーター内の右上＆コマンドバーボタン群（STEP 2バブルが切れないよう overflow: visible を保証） */
#app-shell #group-top-command-bar,
#app-shell .group-command-bar,
#app-shell .group-command-actions {
  overflow: visible !important;
  position: relative !important;
  z-index: 45 !important;
}

#app-shell .hdr-btn,
#app-shell .btn-ai-cross {
  position: relative !important;
  overflow: visible !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: 31px !important;
  padding: 0 14px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: linear-gradient(180deg, #171523 0%, #0e0d16 100%) !important;
  color: #ececf6 !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  transition:
    transform 0.38s var(--bnx-viscous),
    border-color 0.38s var(--bnx-viscous),
    box-shadow 0.38s var(--bnx-viscous),
    background 0.38s var(--bnx-viscous),
    filter 0.38s var(--bnx-viscous) !important;
}

#app-shell .hdr-btn:hover,
#app-shell .btn-ai-cross:hover {
  transform: translateY(-1.5px) !important;
  border-color: rgba(255, 42, 117, 0.65) !important;
  background: linear-gradient(180deg, #241628 0%, #140e1c 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 0, 76, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

#app-shell #btn-open-settings,
#app-shell #btn-save-pos {
  border: 1px solid rgba(255, 42, 117, 0.48) !important;
  background: linear-gradient(135deg, rgba(255, 0, 76, 0.22) 0%, rgba(30, 14, 28, 0.95) 100%) !important;
  color: #ffdce8 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
}

#app-shell #btn-add-group,
#app-shell #btn-add-note-top {
  border: 1px solid rgba(255, 42, 117, 0.52) !important;
  background: linear-gradient(135deg, #2b1022 0%, #160c18 100%) !important;
  color: #ffe4ee !important;
}

#app-shell #btn-run-synthesis {
  overflow: visible !important;
  z-index: 80 !important;
  border: 1px solid rgba(255, 60, 130, 0.62) !important;
  background: linear-gradient(135deg, rgba(219, 20, 90, 0.34) 0%, rgba(110, 18, 95, 0.38) 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 20px rgba(219, 20, 90, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

/* STEP 2 誘導バブルをエディタバーより手前の最前面へ強制表示 */
#app-shell #btn-run-synthesis.qtl-guide-active,
#app-shell #btn-run-synthesis .qtl-guide-bubble,
#app-shell #btn-run-synthesis > span:not(:first-child),
#app-shell #btn-run-synthesis > div {
  z-index: 9999 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* シミュレーター内 EXECUTE 主役ボタン（実機V2と完全同一） */
#app-shell #btn-brainix-execute,
#app-shell #sim-btn-execute-inline {
  height: 33px !important;
  padding: 0 18px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 130, 175, 0.68) !important;
  background: var(--bnx-grad-exec) !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  letter-spacing: 0.14em !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65) !important;
  box-shadow:
    0 6px 24px rgba(255, 0, 76, 0.45),
    0 0 18px rgba(122, 26, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.38) !important;
}

#app-shell #btn-brainix-execute:hover,
#app-shell #sim-btn-execute-inline:hover {
  transform: translateY(-2px) scale(1.02) !important;
  border-color: #ffffff !important;
  filter: brightness(1.12) !important;
  box-shadow:
    0 10px 30px rgba(255, 0, 76, 0.62),
    0 0 26px rgba(255, 42, 117, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

/* 5. AI CROSS / EXECUTE プログレスバーの60fps滑らかレーザー化 */
#app-shell .qtl-exd-progress {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: block !important;
  width: 100% !important;
  height: 11px !important;
  margin: 16px 0 !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 42, 117, 0.45) !important;
  background: rgba(8, 8, 14, 0.92) !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 0 18px rgba(255, 0, 76, 0.22) !important;
}

#app-shell .qtl-exd-progress::-webkit-progress-bar {
  background: rgba(8, 8, 14, 0.92) !important;
  border-radius: 999px !important;
}

#app-shell .qtl-exd-progress::-webkit-progress-value {
  background: linear-gradient(90deg, #ff004c 0%, #ff2a85 50%, #7a1aff 85%, #00f0ff 100%) !important;
  border-radius: 999px !important;
  box-shadow: 0 0 16px rgba(255, 0, 76, 0.85) !important;
  transition: width 0.08s linear !important;
}

#app-shell .qtl-exd-progress::-moz-progress-bar {
  background: linear-gradient(90deg, #ff004c 0%, #ff2a85 50%, #7a1aff 85%, #00f0ff 100%) !important;
  border-radius: 999px !important;
}

/* 6. シミュレーター内ノートカード＆サイドバーの0.58s流体モーション */
#app-shell .left-sidebar {
  background: linear-gradient(180deg, #08070d 0%, #050509 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
}

#app-shell .group-item-card {
  border: 1px solid rgba(255, 255, 255, 0.065) !important;
  border-radius: 9px !important;
  background: linear-gradient(160deg, rgba(18, 18, 28, 0.88), rgba(10, 10, 16, 0.95)) !important;
  transition:
    transform 0.52s var(--bnx-viscous),
    border-color 0.52s var(--bnx-viscous),
    background 0.52s var(--bnx-viscous),
    box-shadow 0.52s var(--bnx-viscous) !important;
}

#app-shell .group-item-card:hover {
  transform: translate3d(4px, 0, 0) !important;
  border-color: rgba(255, 0, 76, 0.45) !important;
}

#app-shell .group-item-card.active {
  transform: translate3d(3px, 0, 0) !important;
  border-color: rgba(255, 0, 76, 0.78) !important;
  border-left: 3px solid #ff004c !important;
  background: linear-gradient(135deg, rgba(255, 0, 76, 0.22) 0%, rgba(18, 11, 22, 0.98) 78%) !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 0, 76, 0.22) !important;
}

#app-shell #memo-slots-container > *,
#app-shell .dominion-note-card {
  position: relative !important;
  overflow: visible !important;
  border: 1px solid rgba(255, 255, 255, 0.085) !important;
  border-radius: 12px !important;
  background-color: #0a0a12 !important;
  background-image:
    radial-gradient(95% 85% at 15% 0%, rgba(255, 0, 76, 0.12), transparent 62%),
    linear-gradient(165deg, rgba(22, 16, 28, 0.96) 0%, rgba(10, 10, 16, 0.99) 62%, rgba(16, 10, 20, 0.97) 100%) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  transition:
    transform 0.58s var(--bnx-viscous),
    border-color 0.58s var(--bnx-viscous),
    box-shadow 0.58s var(--bnx-viscous),
    background 0.58s var(--bnx-viscous) !important;
}

#app-shell #memo-slots-container > *::before,
#app-shell .dominion-note-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, #ff004c 0%, #ff2a75 55%, rgba(122, 26, 255, 0.4) 100%);
  opacity: 0.72;
  pointer-events: none;
}

#app-shell #memo-slots-container > *:hover:not(.qtl-locked-card),
#app-shell .dominion-note-card:hover:not(.qtl-locked-card) {
  transform: translate3d(0, -4px, 0) scale(1.006) !important;
  border-color: rgba(255, 42, 117, 0.65) !important;
  box-shadow:
    0 20px 42px rgba(0, 0, 0, 0.72),
    0 0 26px rgba(255, 0, 76, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
}

/* 7. シミュレーター内のAPI設定画面（.provider-config-card / .dna-box-crimson） */
#app-shell .provider-config-card {
  position: relative !important;
  overflow: hidden !important;
  padding: 18px 20px 18px !important;
  border-radius: 13px !important;
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  background-color: #0a0912 !important;
  background-image:
    radial-gradient(90% 90% at 15% 10%, rgba(255, 0, 76, 0.16), transparent 60%),
    var(--bnx-grid-14),
    linear-gradient(165deg, #160f1c 0%, #090910 58%, #120b18 100%) !important;
  background-size: 100% 100%, 14px 14px, 14px 14px, 100% 100% !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  transition:
    transform 0.55s var(--bnx-viscous),
    border-color 0.55s var(--bnx-viscous),
    box-shadow 0.55s var(--bnx-viscous) !important;
}

#app-shell .provider-config-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2.5px;
  background: linear-gradient(90deg, #ff004c 0%, #ff2a75 50%, #7a1aff 100%);
  opacity: 0.78;
  pointer-events: none;
}

#app-shell .provider-config-card.active-engine,
#app-shell .provider-config-card.active-provider {
  border: 1px solid rgba(255, 42, 117, 0.9) !important;
  background-image:
    radial-gradient(95% 95% at 20% 12%, rgba(255, 0, 76, 0.28), transparent 62%),
    radial-gradient(80% 80% at 85% 90%, rgba(122, 26, 255, 0.2), transparent 65%),
    var(--bnx-grid-14),
    linear-gradient(165deg, #240d1f 0%, #0b0914 56%, #190b1d 100%) !important;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.76),
    0 0 32px rgba(255, 0, 76, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

#app-shell .dna-box-crimson {
  border-radius: 13px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-left: 3px solid #ff004c !important;
  background-color: #0a0912 !important;
  background-image:
    radial-gradient(85% 90% at 10% 0%, rgba(255, 0, 76, 0.13), transparent 60%),
    var(--bnx-grid-14),
    linear-gradient(165deg, rgba(22, 14, 26, 0.96) 0%, rgba(10, 10, 16, 0.99) 70%) !important;
  background-size: 100% 100%, 14px 14px, 14px 14px, 100% 100% !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
