.nm-tutorial-root {
  position: fixed;
  inset: 0;
  z-index: 10020;
  pointer-events: auto;
  color: #111827;
}

@media (min-width: 640px) {
  .tutorial-help-subheader-btn {
    margin-right: 6rem;
  }
}

.nm-tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 160ms ease;
}

html.dark .nm-tutorial-backdrop {
  background: transparent;
}

.nm-tutorial-root.is-visible .nm-tutorial-backdrop {
  opacity: 1;
}

.nm-tutorial-highlight {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--nm-tutorial-w, 0px);
  height: var(--nm-tutorial-h, 0px);
  border: 2px solid rgba(59, 130, 246, 0.95);
  border-radius: 10px;
  box-shadow:
    0 0 0 9999px rgba(15, 23, 42, 0.46),
    0 0 0 6px rgba(96, 165, 250, 0.22),
    0 14px 34px rgba(37, 99, 235, 0.28);
  opacity: 0;
  pointer-events: auto;
  transform: translate3d(var(--nm-tutorial-x, 0px), var(--nm-tutorial-y, 0px), 0);
  transition:
    transform 220ms ease,
    width 220ms ease,
    height 220ms ease,
    opacity 140ms ease,
    border-radius 220ms ease;
}

.nm-tutorial-root.is-visible .nm-tutorial-highlight {
  opacity: 1;
}

html.dark .nm-tutorial-highlight {
  border-color: rgba(125, 211, 252, 0.98);
  box-shadow:
    0 0 0 9999px rgba(2, 6, 23, 0.58),
    0 0 0 1px rgba(248, 250, 252, 0.7) inset,
    0 0 0 7px rgba(56, 189, 248, 0.34),
    0 18px 44px rgba(14, 165, 233, 0.42);
}

.nm-tutorial-root.is-pulsing .nm-tutorial-highlight::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid rgba(147, 197, 253, 0.8);
  animation: nm-tutorial-pulse 620ms ease-out 1;
}

@keyframes nm-tutorial-pulse {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.nm-tutorial-popover {
  position: absolute;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: auto;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    left 140ms ease,
    top 140ms ease;
}

.nm-tutorial-root.is-visible .nm-tutorial-popover {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.nm-tutorial-root.is-switching .nm-tutorial-popover {
  opacity: 0;
  transition-duration: 80ms;
}

html.dark .nm-tutorial-popover {
  border-color: rgba(51, 65, 85, 0.95);
  background: rgba(15, 23, 42, 0.98);
  color: #e5e7eb;
}

.nm-tutorial-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.nm-tutorial-step {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  letter-spacing: 0;
}

html.dark .nm-tutorial-step {
  color: #93c5fd;
}

.nm-tutorial-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  color: #111827;
}

html.dark .nm-tutorial-title {
  color: #f8fafc;
}

.nm-tutorial-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: #374151;
  white-space: pre-line;
}

html.dark .nm-tutorial-body {
  color: #cbd5e1;
}

.nm-tutorial-inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.38em;
  height: 1.38em;
  margin: 0 0.14em;
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.92);
  vertical-align: -0.24em;
}

.nm-tutorial-inline-icon img {
  width: 1em;
  height: 1em;
  object-fit: contain;
  pointer-events: none;
}

html.dark .nm-tutorial-inline-icon {
  border-color: rgba(125, 211, 252, 0.72);
  background: rgba(15, 23, 42, 0.96);
}

html.dark .nm-tutorial-inline-icon img {
  filter: invert(1) brightness(1.15);
}

.nm-tutorial-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.nm-tutorial-actions-left,
.nm-tutorial-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nm-tutorial-btn {
  min-width: 64px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.nm-tutorial-btn:hover {
  background: #f3f4f6;
}

.nm-tutorial-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nm-tutorial-next-wrap {
  position: relative;
  display: inline-flex;
}

.nm-tutorial-next-wrap.is-disabled {
  cursor: not-allowed;
}

.nm-tutorial-next-wrap.is-disabled .nm-tutorial-btn:disabled {
  pointer-events: none;
}

.nm-tutorial-disabled-guide {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 1;
  width: max-content;
  max-width: min(240px, calc(100vw - 48px));
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.96);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 4px, 0);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.nm-tutorial-disabled-guide::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: rgba(17, 24, 39, 0.96);
  transform: rotate(45deg);
}

.nm-tutorial-next-wrap[data-guide-placement="bottom"] .nm-tutorial-disabled-guide {
  top: calc(100% + 8px);
  bottom: auto;
}

.nm-tutorial-next-wrap[data-guide-placement="bottom"] .nm-tutorial-disabled-guide::after {
  top: -5px;
  bottom: auto;
}

.nm-tutorial-next-wrap.is-disabled:hover .nm-tutorial-disabled-guide,
.nm-tutorial-next-wrap.is-disabled:focus .nm-tutorial-disabled-guide,
.nm-tutorial-next-wrap.is-disabled:focus-within .nm-tutorial-disabled-guide {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.nm-tutorial-btn-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.nm-tutorial-btn-primary:hover {
  background: #1d4ed8;
}

.nm-tutorial-btn-ghost {
  min-width: 0;
  border-color: transparent;
  background: transparent;
  color: #6b7280;
}

.nm-tutorial-btn-ghost:hover {
  background: #f3f4f6;
  color: #374151;
}

html.dark .nm-tutorial-btn {
  border-color: #475569;
  background: #1e293b;
  color: #e5e7eb;
}

html.dark .nm-tutorial-btn:hover {
  background: #334155;
}

html.dark .nm-tutorial-btn-primary {
  border-color: #3b82f6;
  background: #2563eb;
  color: #ffffff;
}

html.dark .nm-tutorial-btn-primary:hover {
  background: #1d4ed8;
}

html.dark .nm-tutorial-btn-ghost {
  border-color: transparent;
  background: transparent;
  color: #94a3b8;
}

html.dark .nm-tutorial-btn-ghost:hover {
  background: #1e293b;
  color: #e2e8f0;
}

html.dark .nm-tutorial-disabled-guide,
html.dark .nm-tutorial-disabled-guide::after {
  background: rgba(248, 250, 252, 0.96);
  color: #0f172a;
}

@media (max-width: 639px) {
  .nm-tutorial-popover {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    transform: translate3d(0, 12px, 0);
  }

  .nm-tutorial-popover[data-mobile-placement="above-target"],
  .nm-tutorial-popover[data-mobile-placement="top"],
  .nm-tutorial-popover[data-mobile-placement="below-target"],
  .nm-tutorial-popover[data-mobile-placement="center"] {
    bottom: auto;
  }

  .nm-tutorial-card {
    padding: 14px 14px 16px;
  }
}

.node.nm-tutorial-menu-visible .node-hover-area {
  pointer-events: auto !important;
}

.node.nm-tutorial-menu-visible .node-menu {
  opacity: 1 !important;
  pointer-events: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  .nm-tutorial-backdrop,
  .nm-tutorial-highlight,
  .nm-tutorial-popover {
    transition-duration: 80ms;
  }

  .nm-tutorial-popover {
    transform: none;
  }

  .nm-tutorial-root.is-pulsing .nm-tutorial-highlight::after {
    animation: none;
  }
}


/* チュートリアル選択メニュー */
.nm-tutorial-help-menu {
  position: fixed;
  z-index: 10010;
  width: min(284px, calc(100vw - 24px));
  padding: 6px;
  border: 1px solid rgba(203, 213, 225, 0.96);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.2);
}

.nm-tutorial-help-menu button {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #111827;
  text-align: left;
}

.nm-tutorial-help-menu button:hover,
.nm-tutorial-help-menu button:focus-visible {
  outline: none;
  background: #eff6ff;
}

.nm-tutorial-help-menu button + button {
  margin-top: 2px;
}

.nm-tutorial-help-menu span {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  word-break: keep-all;
}

.nm-tutorial-help-menu small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

html.dark .nm-tutorial-help-menu {
  border-color: #475569;
  background: rgba(15, 23, 42, 0.99);
}

html.dark .nm-tutorial-help-menu button {
  color: #f8fafc;
}

html.dark .nm-tutorial-help-menu button:hover,
html.dark .nm-tutorial-help-menu button:focus-visible {
  background: #1e293b;
}

html.dark .nm-tutorial-help-menu small {
  color: #94a3b8;
}

/* 既存ユーザー向けの一度だけの執筆案内 */
.nm-writing-intro-coachmark {
  position: fixed;
  z-index: 10015;
  width: min(332px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.99);
  color: #111827;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.23);
}

.nm-writing-intro-label {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 9px;
  border-radius: 9999px;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 11px;
  font-weight: 700;
}

.nm-writing-intro-coachmark h2 {
  margin: 10px 0 6px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  word-break: keep-all;
}

.nm-writing-intro-coachmark p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}

.nm-writing-intro-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.nm-writing-intro-actions button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.nm-writing-intro-actions button:hover {
  background: #f8fafc;
}

.nm-writing-intro-actions .nm-writing-intro-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.nm-writing-intro-actions .nm-writing-intro-primary:hover {
  background: #1d4ed8;
}

html.dark .nm-writing-intro-coachmark {
  border-color: #1d4ed8;
  background: rgba(15, 23, 42, 0.99);
  color: #f8fafc;
}

html.dark .nm-writing-intro-coachmark p {
  color: #cbd5e1;
}

html.dark .nm-writing-intro-actions button {
  border-color: #475569;
  background: #1e293b;
  color: #e2e8f0;
}

html.dark .nm-writing-intro-actions .nm-writing-intro-primary {
  border-color: #3b82f6;
  background: #2563eb;
  color: #ffffff;
}

.nm-writing-guide-root .nm-tutorial-highlight {
  pointer-events: auto;
}

.nm-writing-guide-feature-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.nm-writing-guide-feature-groups.hidden {
  display: none;
}

.nm-writing-guide-feature-groups section {
  padding: 9px 10px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.nm-writing-guide-feature-groups h4 {
  margin: 0 0 5px;
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 700;
}

.nm-writing-guide-feature-groups ul {
  margin: 0;
  padding-left: 1.2em;
  color: #475569;
  font-size: 12px;
  line-height: 1.6;
}

html.dark .nm-writing-guide-feature-groups section {
  border-color: #334155;
  background: #0f172a;
}

html.dark .nm-writing-guide-feature-groups h4 {
  color: #bfdbfe;
}

html.dark .nm-writing-guide-feature-groups ul {
  color: #cbd5e1;
}

.nm-writing-guide-setting {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
}

.nm-writing-guide-setting button {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nm-writing-guide-setting button:hover {
  color: #1d4ed8;
}

.nm-writing-guide-setting p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

html.dark .nm-writing-guide-setting {
  border-color: #334155;
  background: #0f172a;
}

html.dark .nm-writing-guide-setting button {
  color: #93c5fd;
}

html.dark .nm-writing-guide-setting p {
  color: #94a3b8;
}

@media (max-width: 639px) {
  .nm-writing-guide-feature-groups {
    grid-template-columns: 1fr;
  }

  .nm-writing-intro-coachmark {
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
  }
}
